开发者

Microsoft JScript runtime error: 'RequestCompleted' is undefined

开发者 https://www.devze.com 2023-01-08 07:38 出处:网络
Anyone got any ideas? The abov开发者_如何学Goe error occurs when the following code is run: Sys.WebForms.PageRequestManager.getInstance().add_endRequest(RequestCompleted);

Anyone got any ideas?

The abov开发者_如何学Goe error occurs when the following code is run:

    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(RequestCompleted);

Within this block:

<script language="javascript" type="text/javascript">
    var postBackElement;

    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(RequestCompleted);
    Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(InitializeRequestHandler);

    function InitializeRequestHandler(sender, args) {
        //set the postBackElement
        postBackElement = args.get_postBackElement();
    }


You need to handle the RequestCompleted event if you're going to use it:

function RequestCompleted(sender, args) {
   // Do what you need to do here
}

If you don't need to handle the event, just remove this line from your markup:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(RequestCompleted);


I think that all you need to do is emit a script block like this:

function RequestCompleted(sender, args) {
  alert("Finished AJAX");
}
0

精彩评论

暂无评论...
验证码 换一张
取 消