如何正确传递 Parse.com 云代码参数

How to pass Parse.com Cloud Code parameters correctly?

本文关键字:代码 参数 com Parse 何正确      更新时间:2023-09-26

>我正在使用 Parse js 调用云代码函数

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

我的云代码函数是:

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

仅传递令牌参数。没有其他日志。有什么想法,这样我就可以停止拔头发了?!

谢谢!!

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

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