You see, I have a JSON with many records and I want to show it on a web page. To add it to an HTML use .append () Jquery.
It works well, it adds all the records and it takes well the styles and everything, but I see a behavior that I do not know how to solve.
When I retrieve a text with several paragraphs from the JSON, in HTML I get everything followed, with no new lines. When I inspect the paragraph, the lines look good on the console.
The piece of code is as follows:
success: function(json){
var datos = JSON.parse(json);
for(var i in datos) {
$("#resultados").append('<div class="cuadro"> \
<p><span class="negrita">Consulta</p> \
<p>'+datos[i].pregunta+'</p> \
<p class="negrita">Respuesta</p> \
<p>'+ datos[i].respuesta+'</p></div>');
}
},
Do I have to pass some function to data [i] to get the lines out?