If you are using ajax in web application , then there might be possibility that user does repetitively action such as click on button more than once which sends same asynchronous requests for every single click,
Before completing first request, another request for the same functionality is get sent and so on…
Here is the simple solution that helps to cancels previous ajax request,
Copy following two java scripts functions on page. it will cancel previous asynchronous requests. It works in asp.net ajax.
function pageLoad()
{
Sys.WebForms.PageRequestManager.getInstance( ).add_initializeRequest(cancelPostBack);
}
function cancelPostBack(sender, args)
{
if (Sys.WebForms.PageRequestManager.getInstance( ).get_isInAsyncPostBack())
{
args.set_cancel(true);
}
}
One Response
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
Continuing the Discussion