1. #1
    Ext User
    Join Date
    Sep 2010
    Posts
    13
    Vote Rating
    0
    jaquin is on a distinguished road

      0  

    Default Uncaught SyntaxError: Unexpected token

    Uncaught SyntaxError: Unexpected token


    Hi,

    I am trying to access the REST API of a website given the url, login name and password passed as parameters. If passed through the JSON request, a callback alert shall be prompted.

    All I want to know is how can I retrieve the session Id but it returns this error "Uncaught SyntaxError: Unexpected token "

    here is the sample of the code:

    var makeJSONPRequest = function() {
    Ext.util.JSONP.request({
    url: 'http://www.site.com/rest/api/login',
    callbackKey: 'callback',
    params: {
    loginName:'username',

    password:'password',

    },
    callback: function(result) {
    Alert('this must occur if method is passed.');
    }
    })
    };

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    15,103
    Vote Rating
    97
    evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold

      0  

    Default


    Does the site actually support cross domain requests? What happens when you visit that url in the browser?
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext User
    Join Date
    Sep 2010
    Posts
    13
    Vote Rating
    0
    jaquin is on a distinguished road

      0  

    Default


    The site does not support cross domain requests. when I visit the url in the browser, I get redirected to the site.

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    15,103
    Vote Rating
    97
    evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold

      0  

    Default


    That's not really useful, the point is, what does the data returned from the site look like?
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,191
    Vote Rating
    63
    aconran is just really nice aconran is just really nice aconran is just really nice aconran is just really nice aconran is just really nice

      0  

    Default


    The error is indicating that the response returned by the server you are accessing is not valid JavaScript.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  6. #6
    Ext User
    Join Date
    Feb 2011
    Posts
    1
    Vote Rating
    0
    nageshdudam is on a distinguished road

      0  

    Question Getting Error - Uncaught SyntaxError: Unexpected token

    Getting Error - Uncaught SyntaxError: Unexpected token


    Hi All,

    I am trying to load 2 xml data as follows.

    Firstly, I want to load the data from 1.xml and show all the titles in the List
    Now, when the user clicks on any of the title, then I want to load another XML corresponding to that selected item from the List. say for example: user clicked on "News" title then it has to load the data from news.xml and show in another panel or detail panel...

    I am able to load the data from 1.xml and show in the List. Also when the user clicks on the "News", I am able to get the selected item record.. but unable to load the "news.xml"

    below is my code snippet:

    var topics = new Ext.List({
    .........
    .........
    ...........
    itemtap: function(view, index, item, e) // this function is executed when user selects title say News...
    {
    var record = view.store.getAt(index);
    .........
    ...........
    Ext.util.JSONP.request({
    url: 'news.xml',
    callbackKey: 'callback',
    params: { },
    callback: function(result) {
    alert(result);
    }
    });
    }


    Hoping to get the quick solution to this prob...

  7. #7
    Sencha User
    Join Date
    Jan 2011
    Posts
    17
    Vote Rating
    1
    pokiekokie is on a distinguished road

      0  

    Default No new threads?

    No new threads?


    Is it correct that it is not possible anymore to open a new thread?

Similar Threads

  1. JSON+decode+syntaxerror
    By veereshsh in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 3 Feb 2009, 7:03 PM
  2. XML Parsing Error: unclosed token
    By cujo13 in forum Ext.nd for Notes/Domino
    Replies: 3
    Last Post: 10 Apr 2008, 5:33 PM
  3. Adding a Token
    By boriscy in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 26 Mar 2008, 11:03 AM