I create a connection to a mysql database in php and load a variable with information from a field in a bd table, my problem is that when loading a lot of information I can not work with this variable using javascript
include("Conexion.php");
$rs = mysqli_query($con, "SELECT * FROM tbl_publicacion WHERE publicacion_id = $publicacion_id");
while($datos = mysqli_fetch_array($rs)){
$descripcion = $datos['publicacion_descripcion'];
}
Then in a script block I have this:
var descripcion = "<?php echo $descripcion; ?>";
alert(descripcion);
If in the field of the table I have little information if it shows me the variable in the alert, but if I have too much information this variable can not work with javascript, it never shows me the alert and when calling this variable in a function this function is never called ...
What can I do to load a variable with the amount of information I want and work with javascript?
Clarifying: the variable with the information in php if it loads the data regardless of the size of the text. to show it with echo shows me the data perfectly. The problem is only by javascript ...