jQuery getJSON() နည်းလမ်း
ဥပမာ
AJAX တောင်းဆိုမှုကို အသုံးပြု၍ JSON ဒေတာကို ရယူပြီး ရလဒ်ကို ထုတ်ပေးပါ-
$("button").click(function(){
$.getJSON("demo_ajax_json.js", function(result){
$.each(result, function(i, field){
$("div").append(field + " ");
});
});
});
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
getJSON() နည်းလမ်းကို AJAX HTTP GET တောင်းဆိုမှုကို အသုံးပြု၍ JSON ဒေတာကို ရယူရန် အသုံးပြုသည်။
အထားအသို
$(selector).getJSON(url,data,success(data,status,xhr))
Parameter | Description |
---|---|
url | Required. Specifies the url to send the request to |
data | Optional. Specifies data to be sent to the server |
success(data,status,xhr) | Optional. Specifies the function to run if the request succeeds Additional parameters:
|