There is a method in Jqery that $.post () makes a simple example of this method:
Jquery.post (URL, [data], [callback], [type]):
Use post to make asynchronous requests
Parameters:
URL (String): The URL address of the sending request.
data (MAP): (optional) The data to be sent to the server, expressed as a Key/value key-value pair.
Callback (Function): (optional) The callback function when loading succeeds (the method is called only if the return state of response is success).
type (String): (optional) The official note is: Type of data to be sent. The type that should actually be requested for the client (Json,xml, etc.)
1.html page (index.html)
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">#\ ' "/jquery-1.3.2.js" ></script><script language= "JavaScript" >function Checkemail () {if ($ (' #email '). val () = = "") {$ (' #msg '). html ("Please enter the email!"); $(' #email '). Focus; return false; } if ($ (' #address '). val () = = "") {$ (' #msg '). html ("Please enter the address!"); $(' #address '). Focus; return false; } ajax_post ();} function Ajax_post () {$.post ("action.php", {email:$ (' #email '). Val (), address:$ (' #address '). Val ()}, function (data) {//$ (' #msg '). html ("Please enter the email!"); alert (data); $(' #msg '). HTML (data); }, "text");//The type returned here is: Json,html,xml,text}</script>
2.php page (action.php)
<? PHP $email $_post ["Email"]; $address $_post ["Address"]; // echo $email;//echo $address; Echo "Success";? >
A simple example of the $.post () method in jquery