jQuery post() Yöntemi
örnek 1
Bir HTTP POST isteği kullanarak sunucudan veri yükleyin:
$("button").click(function(){
$.post("demo_test.asp", function(data, status){
alert("Data: " + data + "\nStatus: " + status);
});
});
Örnek 2
AJAX POST isteği kullanarak bir <div> öğesinin metnini değiştirin:
$("input").keyup(function(){
var txt = $("input").val();
$.post("demo_ajax_gethint.asp", {suggest: txt}, function(result){
$("span").html(result);
});
});
Tanım ve Kullanım
$.post() yöntemi, bir HTTP POST isteği kullanarak sunucudan veri yükler.
Sözdizimi
$(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:
|