Hi: I have a ajax calling within a function that is called when user
clicks the submit button. For some reason the action corresponding to
submit button completes before the ajax call inside. Below is the
code. When I click the Submit button on the page. The first alert
shows "CustList is " (an empty cust list). Then it starts item inside
the each function (Current Shortname is a1, Current Shortname a2 etc).
Any reason why the execution doesn't go in the order I have coded?
$('#newRSubmit').bind('click', function() {
.
.
.
custList = '';
$.ajax({
url: 'u_GetAllowedCustListXML.cgi',
data: 'userid=' + nco_userid + '&useremail=' +
nco_emailid,
type: 'GET',
dataType: 'xml',
timeout: 30000,
error: function(){
jAlert('Error: Unable to get data from CMDB', 'Error');
},
success: function(xml){
$(xml).find('customer').each(function(){
var shortName = $(this).attr("shrtname");
alert ("Current Shortname: " + shortName);
if(custList == '') custList = shortName;
else custList += ',' + shortName;
});
}
});
alert("CustList is " + custList);
});
--
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=.