Reputation: 241
Not sure what is the problem with below code, somehow i am not able to get blockUI() working.
$.ajax({
url : "before",
type : "POST",
dataType : "text",
async : true,
data : formData,
beforeSend : function() { $.blockUI({ message: 'OK' }); },
success : function(response) {
$.unblockUI();
alert("Congrats! Success!");
var successUrl = "after";
window.location.href = successUrl;
return false;
},
error : function(jqXHR, textStatus, errorThrown) {
$.unblockUI();
alert("Oops ! Error occurred !");
}
});// End of ajax
I tried - async : false as well as true.
Upvotes: 0
Views: 1475
Reputation: 5774
As per the discussion we had in comments above, You don't have blockUI script loaded in HTML page..
Download it from here : http://malsup.github.io/jquery.blockUI.js
and include it in script tag..
Message to others :
If you have jQuery 1.9+ and BlockUI plugin, make sure you use jquery-migrate plugin since jquery browser api is deprecated in version 1.9+..
Hope that solves the issue.
Upvotes: 3