为什么对象没有保存在javascript和解析?

时间:2016-07-18 05:45:11

标签: javascript parse-platform

我正在尝试创建一个新的对象并保存它,但是当我尝试保存它{"_resolved":false,"_rejected":false,"_resolvedCallbacks":[],"_rejectedCallbacks":[]}时,我得到了这个。

function saves(cent, dollar){

var se = Parse.Object.extend("Money");
var newse = new se();

newse.set("cent", cent);
newse.set("dollar", dollar);

newse.save(null,{
   success: function (object) { 
    status.success(object);
  }, 
  error: function (object, error) { 
    status.error(error);
  }
 });
}

1 个答案:

答案 0 :(得分:0)

您所描述的内容看起来像Promise。要使用它,您可以通过then注册回调(或两个):

newse.save(null).then(
    function() {
        // This is called when the promise is resolved (success)
    },
    function() {
        // This is called when the promise is *rejected* (failure)
    }
);