Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/418.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Javascript SDK调用带有参数的云代码函数_Javascript_Parse Platform_Sdk_Parse Cloud Code - Fatal编程技术网

如何使用Javascript SDK调用带有参数的云代码函数

如何使用Javascript SDK调用带有参数的云代码函数,javascript,parse-platform,sdk,parse-cloud-code,Javascript,Parse Platform,Sdk,Parse Cloud Code,我知道在iOS sdk中我可以这样做 [PFCloud callFunctionInBackground:@"email" withParameters:@{@"param1": @"quantity1, @"param2": @"quantity2} block:^(NSString *result, NSError *error) { if (error) { //error } else { // make sure the set the

我知道在iOS sdk中我可以这样做

[PFCloud callFunctionInBackground:@"email" withParameters:@{@"param1": @"quantity1, @"param2": @"quantity2} block:^(NSString *result, NSError *error) {
    if (error) {
        //error
    } else {
        // make sure the set the email sent flag on the object
        NSLog(@"result :%@", result);
    }
}];

但是如何使用Javascript函数来实现这一点呢

Parse.Cloud.run("email", { param1:"quantity1", param2:"quantity2" }).then(function(result) {
    // make sure the set the email sent flag on the object
    console.log("result :" + JSON.stringify(result))
}, function(error) {
    // error
});
使用下面的代码可以完美地工作

NSDictionary *param = [[NSDictionary alloc] initWithObjectsAndKeys:@"A",@"param1",@"B",@"param2", nil];
    [PFCloud callFunctionInBackground:@"email" withParameters:param block:^(id object, NSError *error)
    {

    }];
NSDictionary *param = [[NSDictionary alloc] initWithObjectsAndKeys:@"A",@"param1",@"B",@"param2", nil];
    [PFCloud callFunctionInBackground:@"email" withParameters:param block:^(id object, NSError *error)
    {

    }];