Url,[data],[callback],[type]
URL: Send request address.
Data: The Key/value parameter to be sent.
Callback: callback function when sending successfully.
Type: Returns the content format, XML, HTML, script, JSON, text, _default.
What is the difference between 1.get and post?
(1) The Get method transmits a small amount of data, high processing efficiency, low security, will be cached, and post instead.
(2) The Get access browser is considered to be idempotent.
is an identical URL, with only one result [the same is the exact match of the entire URL string].
So, when the second visit, if the URL string does not change, the browser is directly out of the results of the first visit.
Post is considered a variable access, and the browser thinks that the post submission must be changed.
Prevent idempotent access to get by adding "? +new Date () After the URL", [In short, the URL string for each access is different].
This principle should also be adhered to when designing Web pages.
2.AJAX garbled problem
Causes of garbled:
1, xtmlhttp the data returned by default character encoding is Utf-8, if the client page is gb2312 or other encoded data will produce garbled
2, Post method submission data The default character encoding is Utf-8, if the server side is gb2312 or other encoded data will produce garbled
The solutions are:
1, if the client is GB2312 encoding, the server specifies the output stream encoding
2, the server side and the client are using UTF-8 encoding
Gb2312:header (' content-type:text/html;charset=gb2312 ');
Utf8:header (' Content-type:text/html;charset=utf-8 ');
The post of jquery that was found online