我想使用部分视图的jQuery get方法。最好的方法是什么?我读到了jQuery get,最简单的方法就是这段代码:
$.get(@Url.Action('Controller', 'Action'), function () { });
答案 0 :(得分:5)
您只是错过了网址周围的引号,并搞砸了Url.Action
帮助器语法。这是正确的方法:
$.get('@Url.Action("Action", "Controller")', function (result) {
// TODO: process the results of the server side call
});
请注意传递给$ .get方法的url周围的单引号和Url.Action帮助程序的签名。