Frequently asked questions in AJAX applications

Source: Internet
Author: User
Tags return client

Eclipse Debug does not enter an action when the XML document returned by response in 1.ajax,action is malformed.
2.ajax cache problem, you need to join Xmlhttp.setrequestheader ("If-modified-since", "0″"), you can solve.
3. If not AJAX submission, and set the printwriter out = Response.getwriter (), then the JSP will produce Chinese garbled.
4.ajax reason to return XML garbled
Response.setcontenttype ("TEXT/XML;CHARSET=GBK");
PrintWriter out = Response.getwriter ();
That's how it works, if it does:
PrintWriter out = Response.getwriter ();
Response.setcontenttype ("TEXT/XML;CHARSET=GBK");
So Response.setcontenttype ("TEXT/XML;CHARSET=GBK"), it does not work so the return is garbled, this problem for a long time, the code has to look carefully ah.
5.ajax form Submission
Xmlhttp.setrequestheader ("Content-type", "application/x-www-form-urlencoded");
Since the pass is UTF-8 encoded, the corresponding transcoding should be taken when accepting in the action or servlet
6. Dynamic page of the client page cache Ajax does not run
It may be necessary to use Ajax when registering the code username, uploading files online, deleting files, voting programs, and so on without having to refresh the Web page for results. The principle is that JavaScript through the onchange, OnClick, onmouseout and other events to read the Web page of some of the current user action data, and then transfer this data to a dynamic Web page for processing.

Ajax calls the dynamic page that should let this dynamic page not load the client's cache. Similarly, the blog's trackback program, often unable to receive information, can try to write a dynamic page of the trackback program before it is written to the cached statement.

In addition, you can also program code
+math.random ();
Makes it possible to submit a random number each time to avoid client caching.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.