我想在页面加载后调用我的JsonResult,而不是提交按钮。我有两个BeginForm函数。如何从JavaScript调用JsonResult?
$("#loadTableForm").ready(function() {
//$.post($(this).attr("action"), $(this).serialize(), function(response) {
});
<%using (Html.BeginForm()) {%>
//data
<%using (Html.BeginForm("LoadTable", "Home", FormMethod.Post, new { id = "loadTableForm" })) {%>
//Table here should be loaded after page is loaded
<% } %>
<% } %>
我不是jQuery的专家,但我不认为你应该使用现成功能的常规元素,只是文件。当您想要在DOM加载时发生某些事情时使用它。 $(document).ready(function(){ $ .post(“/ home/foobar”,...); }); – Dismissile 2010-08-09 16:54:05