I have build a webapplication using ASP.NET MVC and JQuery. On my local machine this works fine,but when moving it to a Windows server 2003 the JQuery method post stops working. I'm also using the load method and this works fine.
function methodOne(id) {
alert("debug1: <%= Url.Acti开发者_开发百科on( "MethodOne", "controller" ) + "/" %>" + id);
$.post <%= Url.Action( "MethodOne", "controller" ) + "/" %>" + id, function(data) {
alert("debug2");
...
} else {
alert("Debugg: Add presentation to user failed");
}
});
}
The debug2 is never outputed.
$('#panel').load("<%= Url.Action( "Method", "Controller" ) %>");
Works fine.
You have an error in your post function: opening parenthesis and quotes are missing. Also try passing an empty data as second argument to see if this works:
var url = '<%= Url.Action( "MethodOne", "controller" ) %>/' + id;
$.post(url, { }, function(data) {
alert('success');
});
精彩评论