如何正确传递Parse.com Cloud Code参数?

时间:2015-01-27 03:43:44

标签: javascript parameters parse-platform cloud-code

我用Parse js调用云代码函数

Parse.Cloud.run('enterproductwithid', 
     { 
         "token": token,
         "objId": objectIdOfCurrentProd,
         "username": currentUser1.username
     }

我的云代码功能是:

Parse.Cloud.define("enterproductwithid", function(request, response) 
  {
     console.log(request.params);
  });

仅传递令牌参数。没有其他记录。任何想法,所以我可以停止拉我的头发?!

谢谢!

1 个答案:

答案 0 :(得分:3)

不要将参数键放在引号中。它类似于$ .ajax POST函数。

Parse.Cloud.run('enterproductwithid', 
      {
        token: token, 
        objId: objectIdOfCurrentProd, 
        username: currentUser1.username
      },{
      success: function(result) {
          //do neat stuff
      }, 
      error: function(e) {
         //error
      }
});
相关问题