Hi, I am pulling html from my database with a jquery ajax request.
However, if there is a single quote ('), I get a parsing error.
Regular quotes work fine (").
For example, in my database I have:
style=font-family:"times' new roman"
(I put the ' in there after times for testing). With the ' gone it works...
I start the request:
$.ajax({
url: "phps/file.php?id="+id,
dataType: "json",
error: function(uno,dos,tres){
My php file does:
$code = mysql_real_escape_string($results['code']);
//return
header('Content-type: application/x-json');
echo '{';
echo '"code": "' . $code. '"';
echo '}';
The jquery error function gives me:
[object XMLHttpRequest]
parsererror
undefined
I think this is the issue, but I don't know how to fix it:
We are now strict about incoming JSON and throw an exception if we get malformed JSON. If you need to be able to evaluate malformed JSON that is valid JavaScript, you can make a text request and use eval() to evaluate the contents.
Thanks!