I want to POST some data to an aspx page by javascript. I send POST-httprequest to my aspx page and receive the request in my aspx page. But the problem is that there is no parameter in my request. In other words my request.form is empty!
Here is my javascriptcode:
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var http = new XMLHttpRequest();
var url = "https://myserver/1.aspx";
var params = "param1=something¶m2=somethingelse";
http.open("POST", url, false);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
http.send(params);
And here is my aspx page:
<%
protected void Page_Load(object sender, EventArgs e)
{
var first = Request.Form["param1"];
var second = Request.Form["param2"];
var tot = first + second;
}
%>
This method work fine with http-GET-request! Have any idea what the problem is?
Aucun commentaire:
Enregistrer un commentaire