我正在运行Parse云代码,试图在网页上显示我的Twitter提要。这是我在下面的html中使用的javascript。

<script type="application/javascript">

            Parse.initialize("my app id", "my javascript id");
            enter code herevar Tweets = Parse.Object.extend("Tweets");
var query = new Parse.Query(Tweets);
query.find({
    success: function(results) {
        // results is an array of your Tweets
        console.log(results);
    },
    error: function(error) {
        alert("Error: " + error.code + " " + error.message);
    }
});

        </script>


这是console.log中的输出

[ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass ,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubSens, ubclass,ParseObjectSubclass,ParseObjectSubClass,ParseObjectSubClass,ParseObjectSubSub,ParseObjectSubSub,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass,ParseObjectSubclass]

它在我的Parse核心仪表板上显示为77条推文,因此云代码可以正常工作。

我如何只以清晰可读的格式显示内容,即twitter头像,消息,时间等?

我尝试按照下面的教程进行操作,但这没有帮助
https://medium.com/@nannerb/tutorial-storing-tweets-in-parse-via-the-twitter-api-9fe2ee092013

最佳答案

那些对象可能具有toString方法,该方法将返回对象的名称,您可以迭代所有属性以检查它们:

success: function(results) {
    for (var i = 0; i < results.length; i++) {
        for (var prop in results[i]) {
            console.log("Property name -> " . prop);
            console.log("Property value -> " . results[i][prop]);
        }
    }
},

关于javascript - 解析Javascript和Twitter API,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33044858/

10-10 19:53