Callback function in a $.post request
If you have a callback such as:
function(data) {
process(data);
}
开发者_如何转开发
what exactly is data
? How would you specify what data
is if the url that the POST request is sent to redirects to your controller (let's say we're using Ruby on Rails.)?
data
is the response from the server.
Depending on the type
of the jQuery AJAX request, it will be either a string, a parsed JSON object, or an XML DOM tree.
See the documentation.
data is the response that you send from the server. The type of the data depends on the dataType which you set while making AJAX request.
精彩评论