0

hi friends,
I'm trying to read an XML file using a jQuery 1.4 ajax ... the code is something like this ...

$.ajax({
    type: "GET",
    url: "abcde.xml",
    dataType: "xml",
    error: function(){
        /* error lines goes here */
    },
    success: function(){
        /* success lines goes here */
    }
});

it takes time to read the XML file (may be b'cause the file is huge) but it goes into the "error" code straight away and if made to wait the same code enters success codes. why so?
how to resolve this issue?

thanks :)

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Matthew N.
0

hi,
i've found the answer myself. i used

async:false

and it worked :)

BUT, now, i've another issue,
i've a jQuery plugin and i've written a global function (with the above lines of instruction) to read the XML file

function readFile(){
//....
$.ajax({
//...
/*code goes here*/
//...
});
//...
}

and i'm calling the function readFile() within the jQuery plugin. now, what seems to be happening is that the control goes to the readFile() function and it runs asynchronously and the control moves to the next line of code in the plugin, meanwhile executing the readFile() function in the background.

i want the readFile() function to be completely executed before the control moves to the next line of instruction within the plugin ...

how can i get the desired output?

any help is appreciated ...
thanks :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.