title: toggle functions called on click of element?
body: <p>Why when I first click on the span does it call function a and b,
  how do I make it so it calls function a on first click and on second click it calls function b?  </p>
  
  <pre><code>function a(id) {
      $.post("url.php", {'id':id}, function() {
          $(".aa"+id).removeAttr('onclick');
          $(".aa"+id).attr('onclick', b(id);
      );
  }
  function b(id) {
      $.post("url.php", {'id':id}, function() {
          $(".aa"+id).removeAttr('onclick');
          $(".aa"+id).attr('onclick', a(id);
      );
  }
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>&lt;span class="aa '.$item['id'].'"  onclick="a(' . $item['id'] . ')"&gt;A&lt;/span&gt;
  </code></pre>