title: Stop the current getJSON request
body: <p>I have a function who call a getJSON. But the getJSON call is often not finish when the function is call again.</p>
  
  <p>So I want to stop the previous getJSON still running before send the new one.</p>
  
  <p>I try to save my getJSON call in a global variable and call abort() in the beginning of my function, but I got an error</p>
  
  <pre><code>TypeError: vr is undefined
  </code></pre>
  
  <p>Here is my function</p>
  
  <pre><code>var vr;
  
  function getVol() {
      vr.abort();
  
      var data = {
          form : fields
      };
  
      vr = $.getJSON('getVol.php', data).done(function(r) {
  
          $.each( r, function( key, item ) {
              $.each( item, function( key, value ) {
                  if(parseInt(value) &gt; maxValue) maxValue = parseInt(value);
              });
          });
  
      }).fail(function() {
          console.log( "error" );
      });
  }
  </code></pre>
  
  <p>Thanks for help</p>