View Full Version : Uncaught SyntaxError: Unexpected token

22 Sep 2010, 1:56 AM

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() {
url: 'http://www.site.com/rest/api/login',
callbackKey: 'callback',
params: {


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

22 Sep 2010, 3:12 AM
Does the site actually support cross domain requests? What happens when you visit that url in the browser?

22 Sep 2010, 10:15 PM
The site does not support cross domain requests. when I visit the url in the browser, I get redirected to the site.

22 Sep 2010, 10:19 PM
That's not really useful, the point is, what does the data returned from the site look like?

23 Sep 2010, 2:56 PM
The error is indicating that the response returned by the server you are accessing is not valid JavaScript.

3 Feb 2011, 4:01 AM
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);
url: 'news.xml',
callbackKey: 'callback',
params: { },
callback: function(result) {

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

3 Feb 2011, 4:48 AM
Is it correct that it is not possible anymore to open a new thread?