Mar 2, 2008

cancel request vs abort reqeust

In ajax framework, you can cancel request before the request is submitted to the server, you can aborted the request after the request is submitted to the server and before the response is received.

function onInitializeRequest(sender, args){
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    if (prm.get_isInAsyncPostBack() & args.get_postBackElement().id == 'CancelRefresh') {
    }else if (prm.get_isInAsyncPostBack() & args.get_postBackElement().id == 'RefreshButton') {
            ActivateAlertDiv('visible', 'Still working on previous request.');
            else if (!prm.get_isInAsyncPostBack() & args.get_postBackElement().id == 'RefreshButton') {
            ActivateAlertDiv('visible', 'Retrieving headlines.');