javascript - String escape, reading from text file -
i have text file content:
lorem ipsum dolor sit amet i trying read simple content php , put div using javascript. everyting okay if add break line text, doesn't work.
lorem ipsum dolor sit amet this files uploaded server users, not written app.
$.ajax({ type: "post", url: "read.php", data: '', success: function(response) { $("div#content").html(response); } }); if contains special chars, doesn't work again.
lorem ipsum 'dolor sit amet'
on php:
echo json_encode($your_string); that should take care of escaping newlines you.
Comments
Post a Comment