对象未在Parse中保存

时间:2015-08-09 22:53:31

标签: javascript parse-platform

var Gift = Parse.Object.extend("Gift");
var Basketball = new Gift();

Parse.Cloud.define("GiftAddition", function(request, response){
  Basketball.set("p1", true);
  Basketball.set("p2", false);
  Basketball.set("p3", true);
  Basketball.set("p4", false);
  Basketball.set("p5", false);
  Basketball.set("p6", false);
  Basketball.set("p8", true);

  Basketball.save(null, {
    success: function(Gift) {
    // Execute any logic that should take place after the object is saved.
    alert('New object created with objectId: ' + Gift.id);
    },
    error: function(Gift, error) {
    // Execute any logic that should take place if the save fails.
    // error is a Parse.Error with an error code and message.
    alert('Failed to create new object, with error code: ' + error.message);
    }
  });
});

parse deploy之后,我得到了

Finished uploading files Not creating a release because no files have changed

后者只出现,因为我已尝试多次上传代码。云代码会成功保存,但礼品类的数据不会。

1 个答案:

答案 0 :(得分:0)

部署云代码意味着您将代码上传到解析服务器。您需要调用它们才能运行它。部署代码后尝试调用代码。

      Parse.initialize("key", "key");     
    Parse.Cloud.run('GiftAddition', {}, {
      success: function(result) {
        console.log(result)
      },
      error: function(error) {
console.log(error)
      }
    });

尝试从html脚本中调用这样的云代码。