jQuery: The Write Less, Do More JavaScript Library

Ajax/jQuery.ajaxSetup

From jQuery JavaScript Library

Jump to: navigation, search

« Back to Ajax

jQuery.ajaxSetup( options )

Setup global settings for AJAX requests.
See $.ajax for a description of all available options.
Arguments:
optionsOptions
A set of key/value pairs that configure the default Ajax request. All options are optional.

Examples:
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.

$.ajaxSetup({
  url: "/xmlhttp/",
  global: false,
  type: "POST"
});
$.ajax({ data: myData });

NameType