javascript - jquery pass 2 ajax result outside ajax -


i have simple working ajax result.

   jquery.ajax({         type: "post",         url: my_url_query                success:function(response){                                                          }             }).done(function(response) {          //assuming response currchild1 12         res1 = response;                                         window.$vars = { currchild1: res1 };             window.$vars = { currchild2: res2 };    //----> how          $.getscript( "assets/js/main/request_add_staff.js");                         });                      

is posible create ajax pass vars getscript

anyway think im looking..

 async:false 

kinda long code.

but if have idea shorten this... do.

jquery.ajax({     type: "post",     url: "index.php/form_dashboard/get/senior/"+ dataid,      success:function(response){       },      error:function (xhr, ajaxoptions, thrownerror){         alert(thrownerror);     },     async:false  }).done(function(response) {                 res_senior = response;                                                                   });       //result junior jquery.ajax({     type: "post",     url: "index.php/form_dashboard/get/junior/"+ dataid,      success:function(response1){          },      error:function (xhr, ajaxoptions, thrownerror){         alert(thrownerror);     },     async:false  }).done(function(response1) {                res_junior = response1;                                                                  });                window.$vars = { currchild: res_senior, currchildjunior: res_junior };                    $.getscript( "assets/js/main/request_add_staff.js");                 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -