无法发布yammer消息

时间:2014-09-18 14:55:20

标签: javascript yammer

我正在尝试从html页面发布消息。我已经登录了另一个IE窗口。所以登录成功。我发帖时失败了。有人可以快速浏览一下这个JS,看看可能是什么问题吗?此外,从msg返回的所有内容都是它是一个对象。如何找到该对象的属性,以便我自己帮助调试。

    function post() {
        yam.getLoginStatus(function (response) {
            if (response.authResponse) {
                alert(1);
                yam.request({
                    url: "https://www.yammer.com/api/v1/messages.json",
                    method: "POST",
                    data: { "body": "HelloTest" },
                    success: function (msg) { alert("Post was Successful!: " + msg); },
                    error: function (msg) { alert("Post was Unsuccessful..." + msg); }
                    Console.log(msg);
                });
            } else {
                alert(2);
                yam.login(function (response) {
                    if (!response.authResponse) {
                        yam.request({
                            url: "https://www.yammer.com/api/v1/messages.json",
                            method: "POST",
                            data: { "body": "HelloTest" },
                            success: function (msg) { alert("Post was Successful!: " + msg); },
                            error: function (msg) { alert("Post was Unsuccessful..." + msg); }
                        });
                    }
                });
            }
        });
    }

1 个答案:

答案 0 :(得分:0)

第二个问题的答案可能是:

JSON.stringify(yourObject)

我不确定这部分是否正确:

 error: function (msg) { alert("Post was Unsuccessful..." + msg); }
                    Console.log(msg);

您可能需要使用逗号或甚至移动Console.log(msg)...