jQuery post() နည်းလမ်း
ဥပမာ ၁
HTTP POST တောင်းဆိုမှုကို အသုံးပြု၍ ဆာဗာမှဒေတာကို တင်ပါ-
$("button").click(function(){
$.post("demo_test.asp", function(data, status){
alert("Data: " + data + "\nStatus: " + status);
});
});
ဥပမာ ၂
AJAX POST တောင်းဆိုချက်ကို အသုံးပြု၍ <div> ဒြပ်စင်တစ်ခု၏ စာသားကို ပြောင်းပါ-
$("input").keyup(function(){
var txt = $("input").val();
$.post("demo_ajax_gethint.asp", {suggest: txt}, function(result){
$("span").html(result);
});
});
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
$.post() နည်းလမ်းသည် HTTP POST တောင်းဆိုမှုကို အသုံးပြု၍ ဆာဗာမှဒေတာကို တင်ပါသည်။
အထားအသို
$(selector).post(URL,data,function(data,status,xhr),dataType)
Parameter | Description |
---|---|
URL | Required. Specifies the url to send the request to |
data | Optional. Specifies data to send to the server along with the request |
function(data,status,xhr) | Optional. Specifies a function to run if the request succeeds Additional parameters:
|
dataType | Optional. Specifies the data type expected of the server response. By default jQuery performs an automatic guess. Possible types:
|