开发者

JQuery post not working when moving web-app to a win server 2003

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');
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜