开发者

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

开发者 https://www.devze.com 2022-12-24 18:50 出处:网络
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 lo

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

精彩评论

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