Reputation: 1
what is the data type of data in call back function in php ajax after server response
Example:
$('#ff').form({
success:function(data){
alert(**data**);
}
});
Upvotes: 0
Views: 109
Reputation: 4588
its depends what you specify in dataType in ajax call like if you write dataType : 'json' then it would be json.
Upvotes: 0
Reputation: 943686
It depends on the content-type
of the HTTP response, unless you tell jQuery to ignore what the server says what the data is with a dataType
property on the Ajax options object.
The documentation describes it thus:
The data returned from the server, formatted according to the dataType parameter
and
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). The available types (and the result passed as the first argument to your success callback) are…
Upvotes: 1