httpPost没有运行方法
I have a problem with MVC application, the browser is not able to send POST data to the controller method. I did a test with the parameter "GET" - parameter is passed. "POST" - nothing happens is NOK. What to do to POST work?
var save = function()
{
var data = document.getElementById('tarea').innerHTML;
data = JSON.stringify("PiotrDusiskissssssssssssss");
// da = JSON.stringify(da);
//debugger;
console.log(data);
$.ajax({
type: 'POST',
timeout: 3000, // sets timeout to 3 seconds
url: 'http://localhost:62658/Home/SaveEntry',
dataType: "json",
data: {'data':"sdfsdfsdfsdfsd"},
contentType: "application/json;charset=utf-8",
success: function (result) {
console.log('success');
alert("We returned:" + result);
},
failure: function (e) {
console.log('problem');
alert(e);
}
});
};
Problem: method is not fired when I use [HttpPost] method is run for [HttpGet]
[HttpPost]
[ValidateInput(false)]
public JsonResult SaveEntry(string data)
{
string wynik;
string sqlQuery =...
?Briella
2016/06/04 11:56- c#
- ajax
- 点赞
- 收藏
- 回答
1个回复
