简体   繁体   中英

jquery.ajax code that works in firefox but fails in all other browsers

the code is here http://jsfiddle.net/assuredlonewolf/vHC9A/20/

I have no clue what is going on!

I know the url that is being called is not the problem, I make sure I get a new url when I open the code in a new browser since it is a new session and the Facebook's access token changes

In Firefox also it says

{ "error": { "message": "Error validating access token: Session has expired at unix time 1332122400. The current unix time is 1332123847.", "type": "OAuthException", "code": 190 } }

This may be your access token problem but for talking about your function

        function createFriendsUi(elem)

It displayed some thing like INVALID character in Line 52 by IE and Chrome consol said Uncaught SyntaxError: Unexpected token ILLEGAL

there was illegal white space character, i don't know where, but when i re-wrote your function it worked fine in chrome and even in IE also.

your function after re-writing

      function createFriendsUi(elem)
        {
         var container = document.getElementById(elem);
         for (i=0;i<fbUser.friends.allNamesAndIds.length; i++) {
        var info = fbUser.friends.allNamesAndIds[i].split('||');
        var div = document.createElement('div');
        var image = document.createElement('img')
        var name = document.createElement('p');
        var label = document.createElement('label')
        var input = document.createElement('input');
        input.value = 'compare';
        input.type = 'submit'
        label.className = 'uiButton uiButtonConfirm';
        name.innerHTML = info[0];
        div.className = 'ppp';
        image.src = ' http://graph.facebook.com/' + info[1] + '/picture ';
        label.appendChild(input);
        div.appendChild(name);
        div.appendChild(image)
        div.appendChild(label);
        container.appendChild(div);
    }
  }

You are requesting a page with a token that has already expired and Facebook returns

{
   "error": {
      "message": "Error validating access token: Session has expired at unix time 1332122400. The current unix time is 1332123213.",
      "type": "OAuthException",
      "code": 190
   }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM