i want to know if the response is the json or xml, how can i find that out using jquery?
my current code is following, but its giving error, if response is json.
var is_xml = ($('status_code', XMLHttpRequest.responseText)) ? true : false;
error is:
Selector expected.
Expected ‘,’ or ‘{‘ but found ‘”}}”‘.
According to the documentation, the third parameter to an
ajaxErrorcallback is the options object which was passed into the call tojQuery.ajax. You can query thedataTypevalue of that object to determine if the call was expected to return json or xml. Of course, this assumes you set thedataTypeoption appropriately to begin with.