How to send a post mode parameter when Ajax synchronous request

Source: Internet
Author: User

As the parameter pass through the URL behind the background can also be taken, but see send parameters can also be sent parameters, test the server side to accept not send parameters, in the Firebug see sent the request post part is a string, not too much like the normal parameters sent. Search for a long time did not find a way, and then found an article introduced the XMLHttpRequest object's Send method explanation, just know need to set a header property Content-type tell the server is the form to send data, The parameter string in the Send method is then interpreted by the server.

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;


URL behind the background can also be taken, but see send parameters can also be sent parameters, test the server side to accept the sending parameters, in the Firebug see sent the request post is a string, not too much like the normal sent parameters

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.