【发布时间】:2017-11-12 17:24:21
【问题描述】:
Jquery 和控制器代码如下
JQuery:
$.ajax({
url: "/api/ComicApi",
datatype: "text",
data: encoded, //encoded is a MIME64 string
type: "POST",
error: function (request, status, error) {
alert('error');
},
success: function (data) {
}
});
ComicApiController.cs
// POST api/<controller>
[HttpPost] // tried with [HttpPost] and without
public void Post([FromBody]string data)
{
// I hit my breakpoint, but data is ALWAYS null
}
【问题讨论】:
-
你为什么不用 /api/ComicApi/Post url
-
回答有用吗?
-
@hasan power out -- 这几天我不能测试它,我会告诉你的
标签: ajax asp.net-mvc asp.net-web-api