The post method parameter sending Method for Ajax synchronous requests of extjs

Source: Internet
Author: User

Ajax synchronous requests are generally as follows:

VaR conn = ext. Lib. Ajax. getconnectionobject (). Conn;
Conn. Open ("Post", 'HTTP: // localhost: 8080/struts2study/treeddget? Node =-1 ', false );

// The conn object here is actually the XMLHTTPRequest object.

Conn. setRequestHeader ("Content-Type", "application/X-WWW-form-urlencoded; charset = UTF-8 ");
Conn. Send ("Start =" + 0 + "& limit =" + 30);
VaR rootjson = conn. responsetext;

 

Generally, the parameters can be obtained after the URL and the backend, but the send parameter can also be used as the sending parameter. This experiment shows that the server cannot receive the sent parameter, in firebug, we can see that the post part of the sent request is a string, which is not similar to the normally sent parameter. I haven't found a method after searching for a long time. I found an article later.ArticleAfter introducing the sending method explanation of the XMLHTTPRequest object, you need to set a header attribute.Content-TypeInform the server that the form method is used to send data, and then the parameter strings in the send method will be interpreted by the server.

Http://blog.csdn.net/zmxj/archive/2009/08/04/4409597.aspx

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.