View Full Version : Uncaught SyntaxError: Unexpected token :

17 Jan 2011, 6:15 PM
I am new to Sencha touch and trying to get a List from a json data.

Ext.regModel('customer', {
fields: [{
name: 'id',
type: 'string'
}, {
name: 'customerPk',
type: 'string'

var store = new Ext.data.Store({
autoLoad: true,
model: 'customer',
proxy: {
url: 'http://localhost:8080/restservices/findAllCustomers.json',
type: 'scripttag',
reader: {
root: 'customers'

but what i see is the Uncaught SyntaxError: Unexpected token : , The console shows the json data as below


Thanks for the help.

2 Jun 2011, 8:58 AM
Did you get that fixed. I am very new to Sencha, i am trying to build the test application with sencha touch and facing the same issue.
I am using scripttag to query this url http://dev.sencha.com/deploy/touch/examples/nestedlist/getSourceFiles.php (from examples) and creating a nested list.
Here is what i am doing in the store

type: "scripttag",
url: "http://dev.sencha.com/deploy/touch/examples/nestedlist/getSourceFiles.php",
type: "tree",
root: "children"

But i see the same error you are mentioning.

27 Jun 2011, 8:28 AM
Same issue here. Works fine with type "ajax" if I load the json file from localhost. I get an "unexpected token :" if I load with "scripttag" from another server though. Anyone have a solution?

27 Jun 2011, 9:38 AM
It seems like scripttag doesnt help. What you have to do is add a callback to your request and set the server so that it it adds the callback with the results. If you still cant do it then i would say just proxy the calls to your own webserver that actually queries the url(other domain) and returns the results.

4 Aug 2011, 4:03 AM
i would like to add my experience here for the problem when you are getting the error

Uncaught SyntaxError: Unexpected token <

I was having the same error while submitting a simple form without file field but I had mistakenly put the property

fileUpload: true

Which caused the above error. When I removed the property it worked fine.