Welcome Guest, Not a member yet? Register   Sign In
solved- problems with Uncaught SyntaxError: Unexpected token )

(03-23-2018, 04:06 PM)richb201 Wrote: This is a little embarassing. I had my javascript code almost working, fooled with it a little too much trying to get the xhr working. I am using notepad as my editor and thus it has no syntax checking. Additionally I have a really hard time with the inline call back functions. I am trying to run this code in the Chrome debugger and I keep getting "unexpected token )" at the line right after the sendResponse(token). Can anyone see where my syntax is screwed up. Does anyone know of a javascript editor that helps with syntax? Are there any better tools for working with javascript?

////var iToken;
//var userInfo;
var email;
var myArray={};

   function(request, sender, sendResponse) {
     if (request.task =="login"){
        // remove_token();  //get rid of old token
         chrome.identity.getAuthToken({ 'interactive': true }, function(token) {
           if (chrome.runtime.lastError) {
         var x = new XMLHttpRequest();
         x.open('GET', 'https://www.googleapis.com/oauth2/v2/userinfo?alt=json&access_token=' + token);
         x.onload = function() {
 if (x.readyState=200)
          });                       <<this is the line with the uncaught syntax error

      chrome.identity.getProfileUserInfo(function(userInfo) {email=userInfo.email} )  ;                      
      sendResponse( {'email': email});

navigator.geolocation.getCurrentPosition(function(position) {

editor (free):
- atom https://atom.io/
- visualstudio code https://code.visualstudio.com/
- eclipse http://www.eclipse.org/downloads/eclipse-packages/
- netbeans https://netbeans.org/ / https://netbeans.apache.org/ (half dead)

editor (not free):
- phpstorm or webstorm https://www.jetbrains.com/webstorm/ https://www.jetbrains.com/phpstorm/

Messages In This Thread
RE: problems with Uncaught SyntaxError: Unexpected token ) - by Paradinight - 03-23-2018, 10:28 PM

Theme © iAndrew 2016 - Forum software by © MyBB