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

(This post was last modified: 03-23-2018, 11:22 PM by richb201.)

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) {
proof that an old dog can learn new tricks

Messages In This Thread
solved- problems with Uncaught SyntaxError: Unexpected token ) - by richb201 - 03-23-2018, 04:06 PM

Theme © iAndrew 2016 - Forum software by © MyBB