getJson is the method that is used to call the json data by ajax call.
We can only pass the parameter using the get method.
ex of json call function and the data displayed.
var jsonUrl = "Json.htm";
$("#btnJson").click(function () {
$("#dvJson").html(ajax_load);
$.getJSON(jsonUrl, function (json) {
var result = json.name;
$("#dvJson").html(result);
}
);
return false;
});
The json data returned by the Json.htm follow
{ "name": "Hemang Vyas", "age" : "32", "sex": "Male" }
Important
It send data only by get no post is allowed.
It treat the response data as json only.
0 Comment(s)