我使用ASP.NET MVC和JQuery构build了一个web应用程序。 在我的本地机器上这工作正常,但是当它移动到Windows Server 2003的JQuery方法后停止工作。 我也使用加载方法,这工作正常。
function methodOne(id) { alert("debug1: <%= Url.Action( "MethodOne", "controller" ) + "/" %>" + id); $.post <%= Url.Action( "MethodOne", "controller" ) + "/" %>" + id, function(data) { alert("debug2"); ... } else { alert("Debugg: Add presentation to user failed"); } }); }
debug2永远不会输出。
$('#panel')。load(“<%= Url.Action(”Method“,”Controller“)%>”);
工作正常。
您的发布功能中有一个错误:右括号和缺少引号。 另外尝试传递一个空数据作为第二个参数,看看这是否工作:
var url = '<%= Url.Action( "MethodOne", "controller" ) %>/' + id; $.post(url, { }, function(data) { alert('success'); });