【问题标题】:How to call web method from external project?如何从外部项目调用 Web 方法?
【发布时间】:2015-01-16 07:24:35
【问题描述】:

我有两个项目,一个是 Edge Chamber,另一个是 Edge Docs。我想从 Edge Chamber 调用 Web 方法以在 Edge Docs 上启动用户,但 Web 方法没有调用并且没有错误。请帮忙。 这是 Edge Chamber 代码,

    function LaunchInEdgeDocs() {
    $.ajax({
        type: "POST",
        url: "http://localhost:35534/Default.aspx/LaunchChamberUser",
        data: "{userId:'" + userId + "',token:'" + token + "',chamberUserid:'" + cUserId + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        async: false,
        success: function (data) {

        },
        error: function (jqXHR, exception) {

        },
        complete: function () {
        }
    });
}

这是 Edge Docs 代码,

 [WebMethod]
    public static void LaunchChamberUser(string userId, string token, String chamberUserid)
    {
        LoginUser(userId, token, chamberUserid);
    }

【问题讨论】:

    标签: javascript asp.net c#-4.0


    【解决方案1】:

    尝试以这种形式发送您的数据:

    data: {
        userId: userId,
        chamberToken: token,
        chamberUserid: cUserId
    },
    

    【讨论】:

      猜你喜欢
      • 2015-10-14
      • 2022-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-17
      • 1970-01-01
      相关资源
      最近更新 更多