Microsoft JScript runtime error: 'RequestCompleted' is undefined
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");
}
精彩评论