Yes, async to false means that the statement you are calling has to complete before the next statements of your function can be called. If you set async: true then that statement will begin it's execution the same time and the next statement will be called regardless of whether the async statement has completed yet.
jQuery('body #pricegroup-products-container').on('click', '.saveimage' , function (e) {
var returnHtml = '';
jQuery.ajax({
type: "POST",
async: false,
cache: false,
url: url,
data: {id: '12345'},
dataType: "html",
success: function (response) {
returnHtml = response;
}
});
alert(returnHtml);
});
jQuery('body #pricegroup-products-container').on('click', '.saveimage' , function (e) {
var returnHtml = '';
jQuery.ajax({
type: "POST",
async: false,
cache: false,
url: url,
data: {id: '12345'},
dataType: "html",
success: function (response) {
returnHtml = response;
}
});
alert(returnHtml);
});
No comments:
Post a Comment