Partial Load Multiple Div with 1 .get/.ajax call

Partial Load Multiple Div with 1 .get/.ajax call

Hi,

I am trying to update 2 div with a .ajax (i tried also .get ) call and i make this code working, so that the updating is realized within 2 url calls.
but i can 't figure out how to do it within 1 call?

if i try the read the data var then i get the innerHTML of the clicked node (dhis)
i thought i could read up the data var and extract somehow the innerHTML of #checkout_basketList
but i can't because .ajax/.get somehow takes the innerHTML of the clicked node (dhis).
so i have to make a new call that i do with .load (because of the partial load capabillities)
but then again its stupid to do 2 call when all the info is already in the first call, is mine approch not good.

sorry not so good with jquery (and english) more of a php dude. but still jQuery rocks :)

  1. jQuery(document).ready( function($) {
  2.     $('.link').live('click', function() {
  3.         dhis = $(this);
  4.        
  5.         RETURN_POSTID = do_some_js( dhis, 1 );
  6.         return false;
  7.     });
  8. });
  9.      
  10. function do_some_js( dhis, doAjax ) {
  11.     loadingImg = dhis.prev();
  12.     loadingImg.show();
  13.     beforeImg = dhis.prev().prev();
  14.     beforeImg.hide();
  15.     url = document.location.href.split('#')[0];
  16.    
  17.     rawparams = dhis.attr('href');
  18.     params = rawparams.replace('?', '') + '&ajax=1';
  19.    
  20.     nostripparams = rawparams + '&ajax=1'; 
  21.     fixedparams = params.replace(document.location.href, '');  
  22.    
  23.     postid = getParameterByName( 'postid', nostripparams );
  24.     if ( doAjax ) {
  25.    
  26. jQuery.ajax({
  27.           url: url,
  28.           data: fixedparams,
  29.           context: document.body,
  30.             success: function(data){
  31.            
  32.               dhis.parent().html(data);
  33.              
  34.                 if(typeof wpfp_after_ajax == 'function') {
  35.                
  36.                     do_some_after_ajax( dhis, url ); // i send only the url because there is no need to do same query again.
  37.                 }
  38.                
  39.                 loadingImg.hide(); 
  40.                
  41.               alert('Load was performed.');
  42.             }
  43.         });
  44.     }
  45.       return postid;
  46. }
  47. function do_some_after_ajax(dhis, wpurl)  {
  48.   if (dhis.hasClass('add-sidebar')) {
  49.     jQuery( "#checkout_basketList" ).load(wpurl+" #dyn_checkout_basketList");
  50.   }
  51. }
  52. function getParameterByName( name, params )
  53. {
  54.   name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  55.   var regexS = "[\\?&]"+name+"=([^&#]*)";
  56.   var regex = new RegExp( regexS );
  57.   var results = regex.exec( params );
  58.   if( results == null )
  59.     return "";
  60.   else
  61.     return decodeURIComponent(results[1].replace(/\+/g, " "));
  62. }