Siamak Ferdos
Siamak Ferdos

Reputation: 3299

What's default dataType of jquery's ajax and get methods?

I need to know the default value of dataType of $.ajax() and $.get()? It's json or html or others?

Upvotes: 2

Views: 8876

Answers (2)

T.J. Crowder
T.J. Crowder

Reputation: 1073968

It's right there in the documentation:

dataType (default: Intelligent Guess (xml, json, script, or html))

The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string).

Upvotes: 4

Nikhil Batra
Nikhil Batra

Reputation: 3148

If data type is not specified, jQuery will try to infer it based on the MIME type of the response

dataType (default: Intelligent Guess (xml, json, script, or html))

Upvotes: 1

Related Questions