关系查询Parse.com Javascript&显示在表格中

时间:2015-02-25 22:48:02

标签: javascript jquery parse-platform html-table relational

var Level1Results = Parse.Object.extend("Result");
var query = new Parse.Query(Level1Results);
query.lessThanOrEqualTo("LevelNumber","3");
query.include("currentUser");
query.find({
success: function(results) {
//alert("Successfully retrieved " + results.length + " scores.");
// Do something with the returned Parse.Object values
for (var i = 0; i < results.length; i++) { 
  var object = results[i];

(function($) {
   $('#level1-table').append('<tr> <td>' + object.get('SFirstName') + '</td> <td>' + object.get('CurrentLevel') + '</td> <td>' + object.get('RightOrWrong') + '</td> + '</td></tr>');
})(jQuery);
          }
    },
    error: function(error) {
    alert("Error: " + error.code + " " + error.message);
    }
    });

我正在尝试将两个类链接在一起,一个名为currentUser,另一个名为Result,此时我可以从Results类中获取所有要加载的对象..但是当我尝试从currentUser类中获取SFirstName时显示..

如果有人知道我做错了什么傻话..请分享!

1 个答案:

答案 0 :(得分:0)

只需使用get(“currentUser”)

即可
object.get("currentUser").get('SFirstName')