Frequently asked questions in Ajax program development

Source: Internet
Author: User
Tags return
Common problems in the development of AJAX programs, look at the article may be less you make a lot of mistakes.

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 add 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");
Because the pass is UTF-8 encoded, the corresponding transcoding is done when accepting in the action or servlet.



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.