title: Javascript Uncaught SyntaxError: Unexpected identifier error in Chrome debugger
body: <p>I am adapting the <code>XMLHttpRequest</code> from <a href="https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Example%3a_Asynchronous_request" rel="nofollow">this tutorial</a>:</p>
  
  <pre><code>var request = new XMLHttpRequest();  
  request.open('GET', 'http://www.mozilla.org/', true);  
  request.onreadystatechange = function (aEvt) {  
    if (request.readyState == 4) {  
       if (request.status == 200)  
         console.log(request.responseText)  
       else  
         console.log('Error', request.statusText);  
    }  
  };  
  request.send(null);
  </code></pre>
  
  <p>My code is:</p>
  
  <pre><code>var xhr = new XMLHttpRequest();
  xhr.open("POST", "http://ting-1.appspot.com/submithandlertest", true);
  xhr.onreadystatechange = function (aEvt) {
    if (xhr.readyState == 4) {
        if (xhr.status == 200) 
            console.log("request 200-OK");
            chrome.browserAction.setBadgeText ( { text: "done" } );
        else
            console.log("connection error");
            chrome.browserAction.setBadgeText ( { text: "ERR" } );
        setTimeout(function () {
        chrome.browserAction.setBadgeText( { text: "" } );
        }, 2000);
    }        
  }        
  xhr.send(formData);
  </code></pre>
  
  <p>But Chrome debugger gives a <code>Uncaught SyntaxError: Unexpected identifier</code> error on the <code>else</code>. What am I doing wrong? Thanks!</p>