【发布时间】:2010-04-07 02:29:59
【问题描述】:
我有以下网址:
http://localhost:49970/Messages/Index/9999
在视图“索引”处,我有一个表单,我使用 Jquery 将表单数据发布到操作索引(用 [HttpPost] 装饰),如下所示:
查看:
<script type="text/javascript">
function getMessages() {
var URL = "Index";
$.post(
URL,
$("form").serialize(),
function(data) {
$('#tabela').html(data);
}
);
}
</script>
<% using (Html.BeginForm()) {%>
<%=Html.TextArea("Message") %>
<input type="button" id="submit" value="Send" onclick="javascript:getMessages();" />
<% } %>
控制器:
[HttpPost]
public ActionResult Index(FormCollection collection)
{
//do something...
return PartialView("SomePartialView", someModel);
}
我的问题:如何在操作索引中获取参数“9999”和表单FormCollection?
PS:对不起我的英语:)
【问题讨论】:
标签: jquery asp.net-mvc asp.net-mvc-2