Jump to content

[SOLVED] determining AJAX response type (JSON or HTML)


scott212

Recommended Posts

Is there a way (besides RegEx) to determine the response type from an AJAX request? Here's the code that I'm trying:

[code]
if (xmlHttp.readyState==4) { // show results
  var respObj = eval('('+xmlHttp.responseText+')');
  if (respObj.message) {
      document.getElementById('ax_search_main').innerHTML = "<div class=\"createProfile_labels\">"+respObj.message+"</div>";
      ax_process();
  } else {
document.getElementById('ax_search_main').innerHTML = xmlHttp.responseText;
  }
}[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.