标签:http io os 使用 ar for 数据 sp cti
$.post( URL,data,callback );
必需的 URL 参数规定您希望请求的 URL。
可选的 data 参数规定连同请求发送的数据。
可选的 callback 参数是请求成功后所执行的函数名。
使用jquery实现ajax方式如下所示:
$.ajax({
async : false,
type: "POST",
url: "example.php",
data: "name=John&location=Boston"
}).done(function(msg){
alert("Data Saved: " + msg);
}).fail(function(xmlHttpRequest,statusText,errorThrown) {
alert(
"Your form submission failed.\n\n"
+ "XML Http Request: " + JSON.stringify(xmlHttpRequest)
+ ",\nStatus Text: " + statusText
+ ",\nError Thrown: " + errorThrown);
});
这个例子发送name=John和location=Boston两个数据给服务端的example.php,请求成功后会提示用户。
标签:http io os 使用 ar for 数据 sp cti
原文地址:http://my.oschina.net/147258369/blog/312852