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

Cloud Intelligence Leading the Digital Future

Alibaba Cloud ACtivate Online Conference, Nov. 20th & 21st, 2019 (UTC+08)

Register Now >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.