[jQuery] jQuery AJAX call undefined error with special characters
Hi,
I tried to make an AJAX call using jQuery, the data has special
characters, e.g "{'data':'test
'}". It seems failed to pass this
data in the first place. It will work if i just pass
"{'data':'test'}". encodeURIComponent and JSON.stringify failed here
due to the special character "< > /".
Could anyone please help with it? Thanks.
$.ajax({
type: "POST",
url: "services.aspx",
data: "data=" + encodeURIComponent(JSON.stringify(obj)),
dataType: "text",
error: function(xhr, textStatus, errorThrown) {
alert("ERROR"); },
success: function(data)
{
}
});
Regards,
David