title: How call a callback of an Ajax function in another function
body: <p>I have an Ajax function which is loading data from a webservice. It looks like this:</p>
  
  <pre><code> $.ajax({
      type: 'POST',
      url: back + this.path_Uri,
      data: {msg:this.msg},
      dataType: "json",
      success: function (data, statut) {
                          // traitement to not execute here
          window.reloadFreelancersMission= data;
          var number = reloadFreelancersMission.pagination[0].pagenbr;
          window.pagination.ReloadPager(number);
          /////////////////////////////////////////////////
      },
      error: function (data) {
          console.log(data);
      }
  });
  </code></pre>
  
  <p>I need to do some treatment in the result of the response of this web service in another function in another file.</p>
  
  <p>My file contains a function of sending data within my ajax function. It looks like this</p>
  
  <pre><code>sendFiltres: function () {
      $("body").on('change', '.filtres' , function () {
          var choix_filtres = $("#fitre_recherche");
          var msgJson = JSON.stringify(serializeObject($("#fitre_recherche")));
          window.sendData.start(choix_filtres,msgJson);
      })
  },
  </code></pre>
  
  <p>So I need here to use the callback of my function in this way:</p>
  
  <pre><code>request.done(function( msg ) {
      console.log( msg );
  }); 
  </code></pre>
  
  <p>and integrate my treatment, to obtain this for: </p>
  
  <pre><code>request.done(function( msg ) {
      window.reloadFreelancersMission= data;
      var number = reloadFreelancersMission.pagination[0].pagenbr;
      window.pagination.ReloadPager(number);
  }); 
  </code></pre>
  
  <p>but it seems that I can't call this callback in this file. I'm allowed to use it only in the same file of my ajax function, and that's exactly my problem.</p>