这是调用ajax发布我的表单。JQuery没有成功返回
<script type="text/javascript">
$(function() {
$("#GetReport").click(function() {
var d = {input:$("#frm").serialize()};
$.ajax({
type: 'POST',
url: '/Questions/Answer',
data: JSON.stringify(d),
dataType: "json",
contentType: "application/json",
success: function (result) {
alert(result);
}
});
});
});
</script>
,这是我的行动
[HttpPost]
public ActionResult Answer(string input)
{
return Content("Success");
}
当我按下相关按钮,动作被调用,但是当值的回报,我希望要显示一个警告说“成功”,但我得到尽管我的行动被召集,但没有任何事
如何将这项改变输出?我的行动正在受到打击,我能够获取表单数据。这只是我感到困惑的返回声明。 – Farax
你是否从你的'.asmx'试过了这个。如果它从.asmx文件运行,然后检查控制台是否有错误,很容易发现错误。 – Praveen
删除'dataType:“json”,' – Musa