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

标签 javascript parameters parse-platform parse-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);
  });

只传递token参数。没有其他记录。有什么想法可以让我停止拔头发吗?!

谢谢!!

最佳答案

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

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

关于javascript - 如何正确传递Parse.com Cloud Code参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28162866/

相关文章:

javascript - 替换字符串中的管道

mysql - 您可以将 PARSE 与 MySQL 数据库(Joomla 网站)一起使用吗?

javascript - 为什么我得到空值?

javascript - Math.random() 什么时候开始重复?

javascript - 在 JavaScript 中扁平化 JSON

java - java中如何使用参数和实参?

perl - 如何知道perl子例程是否带参数

java - 为什么Java方法的整数参数映射到Int而不是平台类型?

android - 用于图像消息聊天应用程序的 Parse & Pubnub

node.js - 不同 promise 失败期间的不同重定向会导致错误 : cannot call http. ServerResponse.end()