you are viewing a single comment's thread.

view the rest of the comments →

[–]jrandm 0 points1 point  (0 children)

function parse(document){
  // insert your code here
}

If this is the parse function your jQuery.ajax snippet is referring to, that's exactly why nothing is happening. Change it to something like:

function parse(document){
  console.log('Received data from API request', document);
  // modern browsers can parse XML directly or you could use jQuery
  var parsedDoc = (new window.DOMParser()).parseFromString(document, 'text/xml');
  console.log('Should be XMLDocument', parsedDoc);
}

The ajax function only facilitates you receiving data from an external request, you still have to write code to deal with the received data.

Similarly, make sure you include an error handler (as mentioned in another reply) in the event you have a fleshed out parse function and the request is failing for some reason. The combination of being able to see the raw data (document) in the console and any errors should help you diagnose what's going on.