jQuery
HTML
CSS
JavaScript
PHP
SQL
WordPress
jQuery Reference

Quick Reference

The .ajaxSetup() method sets default values for future AJAX requests.

				
					<!-- html element to place output -->
<p id="my_output"></p>
				
			
				
					// on button click get some info and if successful place it in the HTML element
$('button').click(function() {
    $.ajaxSetup({
        url: 'test.txt',
        success: function(result) {
            $('#my_output').html(result);
        }
    });
    $.ajax();
});
				
			

Syntax

				
					$.ajaxSetup({name:value, name:value, ... })
				
			

Name/Value pairs

NameValue/Description
asyncA Boolean value indicating whether the request should be handled asynchronous or not (default is true)
beforeSend(xhr)A function to run before the request is sent
cacheA Boolean value indicating whether the browser should cache the requested pages (default is true)
complete(xhr,status)A function to run when the request is finished (after success and error functions)
contentTypeThe content type used when sending data to the server. (default is: "application/x-www-form-urlencoded")
contextSpecifies the "this" value for all AJAX related callback functions
dataSpecifies data to be sent to the server
dataFilter(data,type)A function used to handle the raw response data of the XMLHttpRequest
dataTypeThe data type expected of the server response.
error(xhr,status,error)A function to run if the request fails.
globalA Boolean value specifying whether or not to trigger global AJAX event handles for the request (default is true)
ifModifiedA Boolean value specifying whether a request is only successful if the response has changed since the last request (default is false)
jsonpA string overriding the callback function in a jsonp request
jsonpCallbackSpecifies a name for the callback function in a jsonp request
passwordSpecifies a password to be used in an HTTP access authentication request
processDataA Boolean value specifying whether or not data sent with the request should be transformed into a query string (default is true)
scriptCharsetSpecifies the charset for the request
success(result,status,xhr)A function to be run when the request succeeds
timeoutThe local timeout (in milliseconds) for the request
traditionalA Boolean value specifying whether or not to use the traditional style of param serialization
typeSpecifies the type of request (GET or POST)
urlSpecifies the URL to send the request to (default is the current page)
usernameSpecifies a username to be used in an HTTP access authentication request
xhrA function used for creating the XMLHttpRequest object

We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.

jQuery
HTML
CSS
JavaScript
PHP
SQL
WordPress

Why 1SMARTchicken?

This site was built and is maintained to benefit my autistic son.
See More →

My Son's Name is Johnny

He was diagnosed as autistic quite late, at age four...
His story

Buy Me a Coffee

Thanks for your support!

Feedback

If you see an error on the page or the code itself is incorrect or incomplete, or just plain wrong, please let us know. We’re always learning. NOTE: we do not sell your information and will not send you spam emails.