title: Comparing old and new value of the same variable in jquery
body: <p>I coded a website using Ajax and I want to compare clicked links to avoid page reloading.
  My way to do it is having a var called <code>Link</code> and storing url into it.
  Everytime I click on the <code>#button</code>, the url is stored into the Link,
  then I call the <code>CompareLink()</code> function, then the <code>GoToLink()</code> function.</p>
  
  <pre><code>var Link;
  
  $('#button').click(function() {
      Link = http://myurl ;
      CompareLink();
      GoToLink();
  }
  </code></pre>
  
  <p>I have trouble with the data comparison. I want to compare the OLD value of <code>Link</code> with the new Value, so I wrote a very vague approach (nonworking) and I wanted to know if somebody could help me.</p>
  
  <pre><code>function CompareLink() {
      if ( Link == .data(Link)) {
          //execute code
      }
  }
  </code></pre>