A quick question on data returned by jquery.ajax() call (EDITED)

Posted by recipriversexclusion on Stack Overflow See other posts from Stack Overflow or by recipriversexclusion
Published on 2010-04-27T15:28:48Z Indexed on 2010/04/27 18:53 UTC
Read the original article Hit count: 257

Filed under:
|
|

EDIT: The original problem was due a stupid syntax mistake somewhere else, whicj I fixed. I have a new problem though, as described below

I have the following jquery.ajax call:

$.ajax({
    type: 'GET',
    url: servicesUrl + "/" + ID + "/tasks",
    dataType: "xml",
    success : createTaskListTable
});

The createTaskListTable function is defined as

function createTaskListTable(taskListXml) {
    $(taskListXml).find("Task").each(function(){  
        alert("Found task")     
    }); // each task
}

Problem is: this doesn't work, I get an error saying taskListXml is not defined. JQuery documentation states that the success functions gets passed three arguments, the first of which is the data.

How can I pass the data returned by .ajax() to my function with a variable name of my own choosing.

My problem now is that I'm getting the XML from a previous ajax call! How is this even possible? That previous function is defined as function convertServiceXmlDataToTable(xml), so they don't use the same variable name.

Utterly confused. Is this some caching issue? If so, how can I clear the browser cache to get rid of the earlier XML?

Thanks!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript