Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ardata=new Array();
- ardata.push("justtesting");
- async.series([
- function(callback){
- for(var i=0;i<=request.body.contact.length-1;i++)
- {
- if(request.body.contact[i].tempid)
- {
- var o=request.body.contact[i];
- pair=Object.keys(o).map(function(a){ return [a, o[a]] });
- AM.addcontact(pair,request.session.user,request.body.contact.length,function(e,o){
- if(!o)
- {
- response.send('something went wrong'+e);
- }
- else
- {
- ardata.push(o);
- }
- });
- }
- /*else if(request.body.contact[i].cid)
- {
- var o=request.body.contact[i];
- pair=Object.keys(o).map(function(a){ return [a, o[a]] });
- AM.updatecontact(pair,request.session.user,function(e,o){
- if(!o)
- {
- response.send('something went wrong'+e);
- }
- else
- {
- showtouser.push(o);
- response.send(showtouser);
- }
- });
- }*/
- else
- {
- response.send('please provide atleast cid or tempid for insertion or updation of contacts');
- }
- }
- callback(null, ardata);
- },
- function(callback){
- // do some more stuff ...
- ardata.push("just testing part 2!");
- callback(null, ardata);
- }
- ],
- // optional callback
- function(err, results){
- response.send(results);
- // results is now equal to ['one', 'two']
- });
- /* HERE IS THE OUTPUT
- [
- [
- "justtesting",
- "just testing part 2!"
- ],
- [
- "justtesting",
- "just testing part 2!"
- ]
- ]
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement