简体   繁体   中英

How can i add additional parameter to cordova.exec success function

I'm new to phonegap and js, and phonegap provides a function

cordova.exec(success,fail,'service','action',args);

The success function only has one argument that is post back from the background.

I wonder if i can add additional arguments to this function to pass data created from js. thanks in advance.

Use this:

 cordova.exec(function(argOfSuccessFunction){
           success(argOfSuccessFunction,yourArgs)
  },fail,'service','action',args);

Call success as callback here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM