Sydwell
Sydwell

Reputation: 5014

Retrieve a specific setting from jQuery.ajaxSetup()

I have page that possibly calls this line.

jQuery.ajaxSetup({async:false})  

In another function I would like to know what state in what state this async flag is at.

Any ideas?

Upvotes: 0

Views: 287

Answers (1)

T.J. Crowder
T.J. Crowder

Reputation: 1074989

The correct thing would probably be to have your page set a flag if it calls ajaxSetup, so you know.

You can hack jQuery instead, though, and use the undocumented jQuery.ajaxSettings object:

if (!jQuery.ajaxSettings.async) {
    // ...
}

As with using anything undocumented, you run the risk of this breaking from one dot release to the next (1.6.0 to 1.6.1, for instance). jQuery's had jQuery.ajaxSettings since version 1.1, but that doesn't mean they won't shake things up.

You can also put in a feature request here (after searching to make sure it hasn't already been requested).

Upvotes: 2

Related Questions