【发布时间】:2010-01-13 16:44:59
【问题描述】:
我的程序控制器中有以下功能:
Function Add(ByVal bpid As Integer) As ActionResult
Return View(GetAvailableProcedures(bpid))
End Function
<AcceptVerbs(HttpVerbs.Post)> _
Function Add(ByVal bpid As Integer, ByVal code As String, ByVal covered As Boolean) As ActionResult
AddProcedure(bpid, codes, covered)
Return View("Close")
End Function
我正在通过 jQuery 加载“添加”对话框,如下所示:
$("#dialog").load(
"/Procedures/Add",
{ bpid: 123 },
function(data) {
alert(data);
});
这是失败的,因为它调用的是 Post 方法(其中“covered”不能为空)而不是 Get。我尝试用<AcceptVerbs(HttpVerbs.Get)> 装饰Get,但它不会改变结果。
为什么这会触发 Post,我如何让它使用 Get?我意识到我可以将名称更改为不模棱两可,但我想知道如果我只传递“bpid”,为什么它不会选择 Get。
【问题讨论】:
标签: jquery asp.net-mvc vb.net post get