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