javascript - What is wrong with the following code for Parse.com Parse.Cloud define and Run and callbacks -


re-asked question real code vs sudo code @ having problems code on parse.com's cloud code

/* doing wrong here?

i didn't want re-write code work parse.cloud.run decided make function me.

error message:

update failed not load triggers. error typeerror: object # has no method 'request'

*/

parse.cloud.define("httpx", function(request, response) {     parse.cloud.httprequest({         url: request.params.url,         method: request.params.method,         headers: request.params.headers     }, {         success: function(httpresponse) {             response.success(httpresponse);         },         error: function(httpresponse) {             response.error(httpresponse);         }     }); });  function sendrequest(path, method, callback) {     if (!initialized) {         throw 'not initialized, call initialize(username, password) first before calling api';     }     // allows 2 paramiters passed if no method passed.     if (typeof method == 'function') {         callback = method;         method = 'get';     }     var type = (usehttps) ? 'http://' : 'https://';     ////////////////////////////////////////     var request = parse.cloud.run("httpx", {         url: type + 'rest.website.com/' + path,         method: method,         headers: headers     }, {         success: function(httpresponse) {             if (callback) {                 callback(httpresponse.text);             }             response.success(httpresponse.text);         },         error: function(httpresponse) {             callback(httpresponse.status);             response.error('request failed response code ' + httpresponse.status);         }     });     ////////////////////////////////////////// } 

response.success(httpresponse.text); 

where define response object?


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -