2014-07-12 68 views
0

我正在使用Parse和JavaScript。Parse.com JS - 使用指針列更新行

我從STATUS_ID -class知道的ObjectId,但不能在Question_status -class更新列,因爲它是一個指針型

我應該如何更新JavaScript的一個指針列。 。

var Answer = Parse.Object.extend("Question_status"); 
    var answer = new Answer(); 
    answer.id = question_status_id; 
    answer.set("answer", selectedAnswer); 
    answer.set("status_id", "duMW5p8Dh3"); 

    answer.save(null, { 
     success: function(answer) { 
     //console.log('New object created with objectId: ' + answer.id); 
     $.mobile.changePage("#finish", { transition: "slideup", changeHash: false }); 
     }, 
     error: function(answer, error) { 
     console.log('Failed to create new object, with error code: ' + error.description); 
     } 
    }); 

回答

0

你基本上可以創建一個指針,你是question_status以同樣的方式:

var answer = new Parse.Object("Question_status"); 
answer.id = question_status_id; 
answer.set("answer", selectedAnswer); 

var status = new Parse.Object("Status_id"); 
status.id = "duMW5p8Dh3"; 
answer.set("status_id", status); 

answer.save(... 
+0

那正是我需要的..謝謝@Fosco – boje