Javascript - use to load xml data from URL

Posted by spenf on Stack Overflow See other posts from Stack Overflow or by spenf
Published on 2014-08-20T22:12:55Z Indexed on 2014/08/20 22:20 UTC
Read the original article Hit count: 117

Filed under:
|
|
|

I have this url with some xml data in it:

http://64.182.231.116/~spencerf/union_college/Upperclass_Sample_Menu.xml

And I would like to load this xml data into my javascript script so I can parse it. I am using parse.com Javascript SDK, in there cloud code.

Here is the code I have tried:

Parse.Cloud.define("next", function(request, response) {
  response.success("Hello world!");

  $.ajax({
    url: 'http://64.182.231.116/~spencerf/union_college/Upperclass_Sample_Menu.xml', // name of file you want to parse
    dataType: "xml", // type of file you are trying to read
    success: parse, // name of the function to call upon success
    error: function(){alert("Error: Something went wrong");}
  });
});

But when I run this I get an error:

$ is not defined

at main.js:

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about Xml