Just add timeout
and an error
handler to your ajax
request:
$.ajax({
type: 'POST',
url: '/Members/MSearch',
contentType: "application/json; charset=utf-8",
data: self.getFormData(),
success: function (data) {
self.members($.map(data.searchResults, function (item) { return new Members(item) }));
$("#foundMembersTableParent").unblock();
},
dataType: "json",
timeout: 30000, // 30 seconds
error: function(qXHR, textStatus, errorThrown) {
if (textStatus === "timeout") {
// request timed out, do whatever you need to do here
}
else {
// some other error occurred
}
}
});
See the docs: https://api.jquery.com/jQuery.ajax/
As a wild guess, I think you are probably using this plugin:
http://malsup.com/jquery/block/#element
In which case, in your error
handler, all you'd really need to do is:
$("#foundMembersTableParent").unblock();
To restore functionality to your grid. Of course, you might also want to bring up and error message somewhere so the user understands why the table didn't change.