1

i have jquery global error event set, like following:

 $("#message_alert").ajaxError(function(event, XMLHttpRequest, settings, thrownError){
    ajax_error(XMLHttpRequest);
 });

and ajax_error method gets the XMLHttpRequest parameter totally fine init. now the request which XMLHttpRequest gets, it also have json data from the backend in XMLHttpRequest.responseText

now i want to know, how can i parse this json data, i tried doing

eval("var request = "+XMLHttpRequest.responseText);

which for some reason was working fine, but dose not work anymore and i know for sure that data is getting back to ajax response. maybe something im doing wrong.. well firebug shows following error from it, i dont know what im doing wrong

Error:

missing ; before statement
http://basit.io.im/javascript/global.js
Line 127

btw this is the same eval line number. any ideas?

1 Answer 1

1

Have you tried -

eval("var request = XMLHttpRequest.responseText");

That should fix the error you are getting.

Sign up to request clarification or add additional context in comments.

2 Comments

thank you, but i think error is something else. not related javascript.. stupid me :(
really? even though the eval statement is on line 127 of global.js or did I misunderstand? If you have it live anywhere I can take look if you want?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.