I’m trying to post some data to a webservice and utilize the XML data it returns. I saw the example in JQuery’s documentation for the post() function:
$.post("test.php", { name: "John", time: "2pm" },
function(data) {
process(data);
},
"xml"
);
What does the process function do? What does the data look like? Do I assign this processed data to a variable? Just trying to get an idea of how I would utilize the values returned from this post().
There is no such standard function. It’s up to you to define it, so it will do whatever you tell it to do.
That will depend on what does your web service returns. If it is XML, it will represent a XML tree. So for example if you service returns the following xml:
you could query the value of the
barnode like this:And here’s a live demo where you can see it in action.