好的,我有一个控制器返回对ajax调用的响应,我想在我的视图中截取该响应。我怎样才能做到这一点?
或者,我如何在视图中引用我的ajax变量?
查看:ContractorList.ascx 控制器:HaulerController.cs
答案 0 :(得分:1)
不确定你究竟在问什么,但我认为答案就是这样:
$.get("/url/to/action", {/* data you're passing to action */}, function (response) {
// your result is available here....
// you want to pass it into the callback method as an argument, as above
// everything your action returns to the page is stored in the response object.
// can you do something like:
var idx = response.indexOf('specific string I expect');
if (idx > -1)
// the string you expected is there so show popup....
}, "html");
return false;
});
如果这不是你想要的,请澄清