views:

1101

answers:

2

Does anyone know the script necessary to check to see if you are in a anync postback via JavaScript?

Thanks.

A: 

Most libraries (jquery etc) set the X-Requested-With header to XMLHttpRequest so you could test for this in the request object, however you do not say your using msajax, jquery or custom script to do the xhr calls. If you give more detail I can advise better.

Other info here that may help you

redsquare
+2  A: 

In the end I used the following which gave me the functionality I required:

Sys.WebForms.PageRequestManager.getInstance()._postBackSettings.async

Peanut
`Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()` is the public documented accessor and should be used instead. Thanks however, I didn't manage to find it before your post.
Julien Lebosquain