Reputation: 2443
$.ajax({
type:"get",
url:"/test/api/?u="+u,
dataType:"json",
data:"",
success:function result(data){
$("#show").html(data);
$("#show").show();
}
});
i don't understand the above code well, especially the success
part. i don't know what will be passed to the parameter data
. expect someone can explain it to me. thank you.
Upvotes: 0
Views: 57
Reputation: 2783
In this case data
is a javascript object, like a dictionary, list, int, string, etc. because the dataType
is json
and jQuery auto-convert the response returned by the url to a javascript object.
Upvotes: 0
Reputation: 15666
data
will hold the content returned by the url that you sent the request to. If the url you are posting to is another HTML page, the code for the entire page will be stored in data
for example.
Upvotes: 1