examples:
例如:请test.php教程网页,但忽略了返回结果。
$.post("test.php");
example:
request the test.php page and send some additional data along (while still ignoring the return results).
请求test.php网页,发送一些额外的数据沿(同时仍忽略了返回结果)。
$.post("test.php", { name: "john", time: "2pm" } );
example: pass arrays of data to the server (while still ignoring the return results).
$.post("test.php", { 'choices[]': ["jon", "susan"] });
example: send form data using ajax requests
$.post("test.php", $("#testform").serialize());
example: alert out the results from requesting test.php (html or xml, depending on what was returned).
$.post("test.php", function(data){
alert("data loaded: " + data);
})
;example: alert out the results from requesting test.php with an additional payload of data (html or xml, depending on what was returned).
$.post("test.php", { name: "john", time: "2pm" },
function(data){
alert("data loaded: " + data);
});example: gets the test.php page content, store it in a xmlhttpresponse object and applies the process() 网页特效 function.
$.post("test.php", { name: "john", time: "2pm" },
function(data){
process(data);
}, "xml");
example: gets the test.php page contents which has been returned in json format ()
$.post("test.php", { "func": "getnameandtime" },
function(data){
alert(data.name); // john
console.log(data.time); // 2pm
}, "json");