If else with ajax call wont work
<p>anyone can tell me why this wont work? It does work when i dont use a if else statement so im a bit stunned atm, i am using a html5 player where the play/pause button toggles, it needs to include the ajax watching when playing and stop watching when paused.  thnx</p>

<pre><code>&lt;script&gt;
var test = 0;

if (test == 0) {
    $("#play").click(function(){
        $.ajax({
            url: "start_watching.php", 
            success: function(result){
                $("#fix").html(result);
            }
        });
   )}; 
   test = 1;
} else if (test == 1) {
    $("#play").click(function(){
        $.ajax({
            url: "stop_watching.php", 
            success: function(result){
                $("#fix").html(result);
            }
        });
   )}; 
   test = 2;
}
&lt;/script&gt;
</code></pre>