title: How to retrieve the XHR parameters after a jQuery Ajax call?
body: <p>In my project I have a column with several filters with jQuery Ajax Calls in order to reduce number of poducts shown in main.php <code>&lt;div id="target"&gt;</code>. Works fine, but after eg sorting the results or clicking pagination in response file main.php, I need to be able to do a new filter-action in the filter-column with the $_GET parameters of the last Ajax call of <code>main.php</code>. These paramaters show up fine in Firebug tab Net - tab XHR - tab Parameters.</p>
  
  <p>But I can't find a way to retrieve the parameters and put them in my function which fires the Ajax call:</p>
  
  <pre><code>     function updateStatus(content_show, data) {
  
       jQuery.ajax({
           method: "get",
           url: content_show,
           data: data,
           beforeSend: function(){
              jQuery("#target").html('&lt;p&gt;&lt;img src="images/ajax_load.gif" /&gt;&lt;/p&gt;');
              }, //show loading just when link is clicked
           success: function(html) {
  
               // update status element            
              jQuery('#target').show("slow");
              jQuery('#target').html(html);
              }
  
       });
   }
  </code></pre>
  
  <p>In my filter file I have a function to check and uncheck the checkboxes and start the ajax call:</p>
  
  <pre><code>function check_them(obj,URL) {
    var getstr = "";
    var man_id_selected ="";
  
   for (i=0; i&lt;obj.getElementsByTagName("input").length; i++) {
      if (obj.getElementsByTagName("input")[i].type == "checkbox") {
  
         if (obj.getElementsByTagName("input")[i].checked) {
  
          getstr = "" + obj.getElementsByTagName("input")[i].name + "=";
          man_id_selected += obj.getElementsByTagName("input")[i].value + "_";
         } else {
       &lt;!--     getstr += obj.getElementsByTagName("input")[i].name + "=&amp;";--&gt;
         }
      }
  
    }
          getUrlStatus('main.php', function(status) { // try to find $_GET parameters of main.php
            alert(status);
             });
    updateStatus(URL, getstr+man_id_selected);    
     }
  </code></pre>
  
  <p>Here I also tried to find the XHR parameters with:</p>
  
  <pre><code> function getUrlStatus(url, callback) {
       jQuery.ajax({
           url: url,
           complete: function(xhr) {
               callback(xhr.status);
  
           }
       });
   }
  </code></pre>
  
  <p>But the latter off course will only return Status 200 and not the Parameters.</p>
  
  <h2>Edit</h2>
  
  <p>After more reading and testing I almost solved the problem by changing my original PHP code and functions for proper formatting of the function updateStatus with a callback:</p>
  
  <pre><code>     function updateStatus(url, base_url, new_parameters, old_parameters) {
  
       jQuery.ajax({
           method: 'get',
           url: base_url,
           data: new_parameters,
           beforeSend: function(){
              jQuery("#target").html('&lt;p&gt;&lt;img src="images/ajax_load.gif" /&gt;&lt;/p&gt;');
              }, //show loading just when link is clicked
           complete: function(){ 
              jQuery("#target").hide("fast");
              }, //stop showing loading when the process is complete
  
  
           success: function(html) {
               // update status element            
              jQuery('#target').show("slow");
              jQuery('#target').html(html);
              callback(this.url)
           }
       });
   }
  </code></pre>
  
  <p>Now I only have I slight problem retriving and calling the new url to $url in PHP. I will elaborate on that and possibly post a new topic.</p>