This example describes the use of the post () method of Ajax in jquery. Share to everyone for your reference. The specific analysis is as follows:
The $.post () method requests data from the server via an HTTP POST request.
Syntax structure:
Copy Code code as follows:
$.post (Url,data,callback);
Parameter resolution:
1.URL: Must, specify the URL of the request.
2.data: Optional, specify the data to be sent along with the request.
3.callback: Optional, specify the name of the function to be executed after the request succeeds.
Code instance:
Copy Code code as follows:
<! DOCTYPE html>
<meta charset= "Utf-8" >
<meta name= "Author" content= "http://www.jb51.net/"/>
<title> Cloud-dwelling community </title>
<script type= "Text/javascript" src= "Mytest/jquery/jquery-1.8.3.js" ></script>
<script type= "Text/javascript" >
$ (document). Ready (function () {
$ ("#bt"). Click (function () {
$.post ("mytest/demo/antzone.html", function (data,status) {
Alert ("Data:" +data+ "\nstatus:" +status);
})
})
})
</script>
<body>
<input type= "button" value= "View Effect" id= "BT"/>
</body>
I hope this article will help you with your jquery programming.