Tag: Browser server string User false
One, using Ajax to send a GET request
Steps to send an asynchronous request
-Get Ajax object: Get XMLHttpRequest Object instance
-Create Request: Call the Open method of the XMLHttpRequest object
-Set the callback function: Set the response function for the onreadystatechange event of the Ajax object
-Send request: Call the Send method of the Ajax object
-Get Ajax object 650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/7E/7A/wKioL1cCJXDQVmhbAAEuwaWAOB8358.png " Title= "Web.png" alt= "Wkiol1ccjxdqvmhbaaeuwawaob8358.png"/>
-Create Request
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7E/7A/wKioL1cCJbSRucYPAAAv5KuoQ64196.png "title=" Web.png "alt=" Wkiol1ccjbsrucypaaav5kuoq64196.png "/>
Note
-true: Indicates the sending of an asynchronous request (the user can still do other things to the current page when the Ajax object sends the request)
-False: Indicates the sending of a synchronization request (when the Ajax object sends a request, the browser locks the current page and the user cannot do anything else on the current page)
-Set callback function
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7E/7D/wKiom1cCJhOxuiaCAADLnaQvY9I426.png "title=" Web.png "alt=" Wkiom1ccjhoxuiacaadlnaqvy9i426.png "/>
-Send Request
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7E/7D/wKiom1cCJqqz2pd9AAEROToh3Mo703.png "title=" Web.png "alt=" Wkiom1ccjqqz2pd9aaerotoh3mo703.png "/>
Writing server-side code
-The server typically returns part of the data, such as a simple text
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7E/7A/wKioL1cCJ-OydzBTAAAxVjrve5Q511.png "title=" Web.png "alt=" Wkiol1ccj-oydzbtaaaxvjrve5q511.png "/>
Second, use Ajax to send a POST request
Send string
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7E/7D/wKiom1cCKDzDmJ31AAEzfU7oWIg296.png "title=" Web.png "alt=" Wkiom1cckdzdmj31aaezfu7owig296.png "/>
-POST Request:
-Need to manually set the request message header to application/x-www-form-urlencoded
-A commit parameter is passed within the Send method, and no nullable
Summary: This chapter focuses on Ajax (using AJAX to send a GET request, using AJAX to send a POST request)
This article from the "Flying Ants" blog, declined to reprint!
JavaScript Ajax-2 Ajax (use Ajax to send GET requests, use AJAX to send post requests)