0

I am calling a cloud code function with Parse js

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

And my cloud code function is:

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

Only the token parameter is passed. Nothing else logs. Any thoughts so I can stop pulling my hair out?!

Thanks!!

garrettmac
  • 8,417
  • 3
  • 41
  • 60
user2918201
  • 52
  • 1
  • 7
  • The code is working fine for me. Have you checked that the variable you use in your request actually contain data and are not empty? – Björn Kaiser Jan 27 '15 at 12:13

1 Answers1

4

Do not put the parameter keys in quotes. It is similar to a $.ajax POST function.

Parse.Cloud.run('enterproductwithid', 
      {
        token: token, 
        objId: objectIdOfCurrentProd, 
        username: currentUser1.username
      },{
      success: function(result) {
          //do neat stuff
      }, 
      error: function(e) {
         //error
      }
});
garrettmac
  • 8,417
  • 3
  • 41
  • 60
cgauss
  • 324
  • 3
  • 16