将 Web 应用程序移动到 win 服务器 2003 时,JQuery 帖子不起作用

发布于 2024-08-27 02:38:33 字数 602 浏览 1 评论 0原文

我使用 ASP.NET MVC 和 JQuery 构建了一个 Web 应用程序。在我的本地计算机上,这工作正常,但是当将其移动到 Windows Server 2003 时,JQuery 方法帖子停止工作。我也在使用 load 方法,效果很好。

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("方法", "控制器") %>");

工作正常。

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.Action( "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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

虚拟世界 2024-09-03 02:38:33

您的 post 函数有错误:缺少左括号和引号。还可以尝试传递一个空数据作为第二个参数,看看这是否有效:

var url = '<%= Url.Action( "MethodOne", "controller" ) %>/' + id;
$.post(url, { }, function(data) {
    alert('success');
});

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');
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文