【发布时间】:2018-02-15 11:41:54
【问题描述】:
我正在尝试使用 Angular JS 向 .NET 服务器发出 post 请求
我能够得到响应,但服务器没有看到我的请求数据。
客户:
var header = {"Content-Type":"multipart/form-data"};
var data = {name:"bill", email:"bill@email.com", phone:"1234567890" };
$http.post("//dot.net/resource", data, header).then(function(res){
console.log(res.data);
},function(err){ console.log(err); });
服务器:
if(HttpContext.Current.Request.HttpMethod.ToString().ToLower() == "post") {
Response.Write("hello request"); // I see this in the response
Response.Write(Request.Form["name"]); // nothing : (
}
我对@987654324@ 不是很熟悉。 Request.Form 基本上像 php 中的 $_POST 吗?
如何使用$http 将一些变量传递给服务器?
【问题讨论】:
标签: javascript .net angularjs ajax curl