title: jquery toggle between 3 states and post a ajax call?
body: <p>I need to toggle between 3 states</p>
  
  <ul>
  <li>state #1: Unselected just grey background</li>
  <li>state #2: Selected set background to green</li>
  <li>state #2: Clicked again, set background to red
  Now on every click toggle between red and green</li>
  </ul>
  
  <p>How would this be possible?
  Beside changing a class I also need to make an ajax call at the same time.</p>
  
  <p>What I basically just want is a selected, not selected toggle and 
  I have no idea how to detect is a user clicked the grey box the first time</p>
  
  <p>For starters I now have:</p>
  
  <pre><code>&lt;div id="test" onclick =&gt; "$(this).toggleClass('selected_yes')"&gt; test &lt;div&gt;
  </code></pre>