A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://api.jquery.com/jQuery.ajaxSetup/ below:

jQuery.ajaxSetup() | jQuery API Documentation

jQuery.ajaxSetup( options )Returns: PlainObject

Description: Set default values for future Ajax requests. Its use is not recommended.

For details on the settings available for $.ajaxSetup(), see $.ajax().

All subsequent Ajax calls using any function will use the new settings, unless overridden by the individual calls, until the next invocation of $.ajaxSetup().

Note: The settings specified here will affect all calls to $.ajax or Ajax-based derivatives such as $.get(). This can cause undesirable behavior since other callers (for example, plugins) may be expecting the normal default settings. For that reason we strongly recommend against using this API. Instead, set the options explicitly in the call or define a simple plugin to do so.

For example, the following sets a default for the url parameter before pinging the server repeatedly:

Now each time an Ajax request is made, the "ping.php" URL will be used automatically:

Note: Global callback functions should be set via .on() with their respective global Ajax events—ajaxStart, ajaxStop, ajaxComplete, ajaxError, ajaxSuccess, ajaxSend—rather than within the options object for $.ajaxSetup().

Example:

Sets the defaults for Ajax requests to the url "/xmlhttp/", disables global handlers and uses POST instead of GET. The following Ajax requests then sends some data without having to set anything else.

1

2

3

4

5

6

$.ajax({ data: myData });


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4