Hi,
I am using ajax to rean an XML file as below.
function GetConfig(ConfigKey) {
var returnvalue = 0;$.ajax({
type: "GET",
url: "PNRates.xml",
datatype: "xml",
success: function (xml) {
var LatestConfig = $(xml).find('configs').find('Latest').text();
//alert("success Values is :" + LatestConfig);
returnvalue = parseInt(LatestConfig);
},
error: function (xhr, status, error) {
//alert("Service Call Failed !" + error);
}
});
//alert("returnvalue" + returnvalue);
return returnvalue
}When the GetConfig finction is called, only GET part is run for the first time and control goes back to the line where the function GetConfig was called without going inside Success or error. Once all jquery is finished running, the control comes back directly to the success part. First time, the value returned from this function is 0 and second time it is whatever read from the XML file.
Can someone please help me understand why 0 is returned without executing success?