試圖顯示來自控制器的成功消息?jsonresult不回來?
[HttpPost]
public JsonResult SuccesMsg()
{
return Json(new { Success = true });
}
的jQuery:
$("#but").click(function() {
$.ajax({
url: "/Home/SuccesMsg",
type: 'POST',
data: "",
success: function (result) {
if (resultJson['Success'] == true) {
alert('success');
}
else
{ alert('no'); }
},
error: function (err) { alert('error') }
});
});
你在firebug中看到的反應是什麼? – 2011-02-09 11:50:01
'resultJson`是什麼?是否有任何警報顯示? – 2011-02-09 11:50:24
沒有反應,我改變了resultJson結果 – 2011-02-09 12:46:10