The request way, divides into get and post:get most common HTTP request, the ordinary browsing page is the get. The parameter request for Get mode is directly followed by the URL and begins with a question mark. (JS used Window.location.search to get). Parameters can be encoded using encodeuricomponent, in the form of:
var enparam = encodeuricomponent (param);
URLs support only about 2K of length, that is, 2048 characters; using get for AJAX requests caches the resulting page is not correct, the general method is random parameter value; ajax.send (null).
POST
Submitting data to the server is used.
You need to remove the values from form forms into strings, connect with & symbols (same as get pass parameters), submit data 2GB, use Ajax.setrequestheader (' Content-type ', ' application/ X-www-form-urlencoded '), processing the submitted string, Ajax.send (strings), which represents what needs to be committed in the form, such as a=1&b=2 a string like this.
Synchronous and asynchronous:
In the Ajax.open method, the 3rd parameter is set either synchronously or asynchronously. Prototype, such as JS class library generally default to asynchronous, that is set to true. First of all, in the case of synchronization, JS will wait for the request to return to get status. The onReadyStateChange event handler function is not required. Asynchronous, however, requires onreadystatechange event handling and a value of 4 to properly handle the content below.
(Note: The Ajax in this article represents the XMLHTTP request object.) )