I need to execute code once my XML file (or object) has been returned successfully. Not before, and not repeatedly; just one time after the file has been returned.
Does my code already do what I am trying to accomplish? It seems to have failed a couple of times in IE and I need to be sure that it is reliable.
$(document).ready(function(){
(function GetFile(){
$.ajax({
type: "GET",
url: "Produce.xml",
dataType: "xml",
cache: false,
success: function(result) {
alert("XML File is loaded!");
alert(result);
},
async: true
});
})();
});
I know that there are onerror
codes and readystatechange
values that can be checked and verified... Should I be checking these values while polling the server for the XML file?