我想进行POST请求,我这样做:
function Xxx_Click() {
var params = new Array();
var p1 = new Object();
p1.Name = "id";
p1.Value = 1;
params.push(p1);
post( <%=Url.Action("Act","Ctrl")%> , params);
}
function post(url, params) {
var form = document.createElement( form );
form.action = url;
form.method = POST ;
form.id = "fTest";
for (var i = 0; i < params.length; i++) {
var hidden = document.createElement( input );
hidden.type = hidden ;
hidden.id = params[i].Name;
hidden.name=params[i].Name;
hidden.value = params[i].Value;
form.appendChild(hidden);
}
$( #fTest ).submit();
}
but i don t reach the server side. I want to make a classic post and not to user $.post(...), how to make it right?