I have the following problem, I am uploading a paragraph to a view in html . The problem I have, is that I'm placing blank space within the p tag of html . Which when reading the content of that paragraph, with javascript to replace the text does not realize it since it finds me this . I leave the code to see if you can help me.
Note: I am inserting the text into the database through ckeditor I need it to be from php , removing the spaces within the label. Since if I do it by javascript it does not replace the text complete but a part.
Function php.
public function getParrafo(){
$tipo = input_post('tipo');
$obj = $this->pre->get_preguntaId($this->id);
if($tipo == 27 OR $tipo == 33){
$texto = strip_tags(trim($obj->contenido),"<p>");
}else{
$texto = strip_tags($obj->contenido,chr(13).chr(10));
}
$jdata['texto'] = $texto;
echo json_encode($jdata);
This is what I get from the php in the echo.
<p>
La Convención de las Naciones Unidas sobre el Derecho del Mar, el tratado más importante jamás negociado en ese ámbito, es relativamente reciente. Entró en vigor el 16 de noviembre de 1994. Pero sus orígenes se remontan a comienzos de los años cincuenta, época en que se creó la Comisión de Derecho Internacional de las Naciones Unidas, encargada de desarrollar teniendo en cuenta la práctica de los Estados, el derecho internacional, gran parte del cual era necesario redactar.</p>
jquery
$.post('index.php?c=unidades&f=getParrafo',{id:id,tipo:tipo},function(data){
$("div#texto0").html(data.texto);
},'json');
html
<p>
La Convención de las Naciones Unidas sobre el Derecho del Mar, el tratado más importante jamás negociado en ese ámbito, es relativamente reciente. Entró en vigor el 16 de noviembre de 1994. Pero sus orígenes se remontan a comienzos de los años cincuenta, época en que se creó la Comisión de Derecho Internacional de las Naciones Unidas, encargada de desarrollar teniendo en cuenta la práctica de los Estados, el derecho internacional, gran parte del cual era necesario redactar.</p>
This is how I read it javascript
"
La Convención de las Naciones"