本文共 2588 字,大约阅读时间需要 8 分钟。
Sends an asynchronous http POST request to load data from the server. Its general form is:
发送异步http POST请求以从服务器加载数据。 其一般形式为:
jQuery.post( url [, data ] [, success ] [, dataType ] )
$.post('http://example.com/form.php', {category:'client', type:'premium'});
requests form.php
from the server, sending additional data and ignoring the returned result
从服务器请求form.php
,发送其他数据并忽略返回的结果
$.post('http://example.com/form.php', {category:'client', type:'premium'}, function(response){ alert("success"); $("#mypar").html(response.amount);});
requests form.php
from the server, sending additional data and handling the returned response (json format). This example can be written in this format:
从服务器请求form.php
,发送其他数据并处理返回的响应(json格式)。 该示例可以用以下格式编写:
$.post('http://example.com/form.php', {category:'client', type:'premium'}).done(function(response){ alert("success"); $("#mypar").html(response.amount);});
The following example posts a form using Ajax and put results in a div
以下示例使用Ajax发布表单并将结果放入div中
jQuery.post demo
The following example use the github api to fetch the list of repositories of a user using jQuery.ajax() and put results in a div
以下示例使用github API使用jQuery.ajax()获取用户的存储库列表,并将结果放入div中
jQuery Get demo
$.post( url [, data ] [, success ] [, dataType ] )
is a shorthand Ajax function, equivalent to:
$.post( url [, data ] [, success ] [, dataType ] )
是Ajax的简写功能,等效于:
$.ajax({ type: "POST", url: url, data: data, success: success, dataType: dataType});
$.ajax()
provides way more options that can be found
$.ajax()
提供了更多可以在找到的选项
For more information, please visit the
欲了解更多信息,请访问
翻译自:
转载地址:http://hmrwd.baihongyu.com/