I am ajaxing a page and on success I have following code:
success: function(html){
var product_json = [];
data=$(html);
$(".product_json", data).each(function(){
product_json.push( jQuery.parseJSON( $(this).html() ) );
});
....
//code continue
My Json looks like:
{
"item_logoagenzia": "/resource/loghi/medium/13.gif",
"item_description": "Some Bernini ven.."
}
It works fine if I have some chars like double quotes it stopped working.
Error Json looks like:
{
"item_logoagenzia": "/resource/loghi/medium/13.gif",
"item_description": "Some "Bernini" ven.."
}
I do not have control over json creation. How to modify it or remove special characters like double qoutes in script given above?
I have done it. I modified my code:
to
I am not sure about efficiency of the code but it looks like it works fine.