Calling a cloud code function from javascript is throwing a "invalid function" error.
I have used parse.com a few years ago before the shutdown. i heard from back4app a few days ago and the basic setup was very fast. anyway i am not able to use the cloudcode function from javascript. my android app can successfully call functions within the same main.js. using the hello function to keep it simple. i have already tried to setup a webhook for this function. then i get the error "unauthorized". not sure if this needs a webhook.
main.js file
Parse.Cloud.define("hello", function(request, response) {
Parse.Cloud.useMasterKey();
response.success("Hello world!");
});
local html file
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<script type="text/javascript" src="https://npmcdn.com/parse@2.1.0/dist/parse.min.js"></script>
</head>
<body>
<script>
Parse.serverURL = "https://parseapi.back4app.com/";
Parse.initialize(
'xxxx', // This is your Application ID
'xxxx' // This is your Javascript key
);
Parse.Cloud.run('hello').then(function(r){
console.log(r);
}, function(error){
console.log(error);
});
</script>
</body>
</html>