jQuery post() 方法
jQuery 教程
· 2019-03-28 14:38:34
实例 1
使用 HTTP POST 请求从服务器加载数据:
$("button").click(function(){
$.post("demo_test.html",function(data,status){
alert("Data: " + data + "nStatus: " + status);
});
});
实例 2
使用 AJAX 的 POST 请求来改变 <div> 元素的文本:
$("input").keyup(function(){
txt=$("input").val();
$.post("demo_ajax_gethint.html",{suggest:txt},function(result){
$("span").html(result);
});
});
定义和用法
$.post() 方法使用 HTTP POST 请求从服务器加载数据。
语法
$(selector).post(URL,data,function(data,status,xhr),dataType)
| 参数 | 描述 |
|---|---|
| URL | 必需。规定将请求发送到哪个 URL。 |
| data | 可选。规定连同请求发送到服务器的数据。 |
| function(data,status,xhr) |
可选。规定当请求成功时运行的函数。 额外的参数:
|
| dataType |
可选。规定预期的服务器响应的数据类型。 默认地,jQuery 会智能判断。 可能的类型:
|
点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html
How to Solve It
Zbigniew Michalewicz、David B. Fogel / Springer / 2004-03-01 / USD 59.95
This book is the only source that provides comprehensive, current, and detailed information on problem solving using modern heuristics. It covers classic methods of optimization, including dynamic pro......一起来看看 《How to Solve It》 这本书的介绍吧!