Hasani
Hasani

Reputation: 3869

How these arguments of ajax function work?

I am whatching a tutorial that has the following code

enter image description here

But I can't understand what are url, cache and success? Are they arrays? How do they work?

Upvotes: 0

Views: 41

Answers (1)

Ced
Ced

Reputation: 1539

You can find below the explanations:


cache

Type: Boolean
A Boolean value indicating whether the browser should cache the requested pages. Default is true.
If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters.

url

Type: String
Specifies the URL to send the request to. Default is the current page

success(result,status,xhr)

Type: Function( Anything data, String textStatus, jqXHR jqXHR )
A function to be run when the request succeeds A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter or the dataFilter callback function, if specified; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object.

Everything is explained in the jQuery.ajax() Documentation

Upvotes: 1

Related Questions