View Full Version : JSON Error

4 May 2011, 12:02 AM

I contact you because I'm in a deadlock.
I try to get data from a extern web service with "ScriptTag" but it does not work because the web service returns simple json format (No JSONP).

Do you know if there is a another way to retrieve json using sencha ?

var helloWorld = new Ext.Application({

Parking: Ext.regModel('Parking', {

launch: function() {
this.tabs = new Ext.TabPanel({
fullscreen: true,
dockedItems: [{xtype:'toolbar', title:'JSON Recovery'}],
tabBar: {
ui: 'light',
layout: {
pack: 'center'
items: [
{cls:'Page1', title:'Page1', html:'Page1'},
cls: 'list',
title: 'Page2',
xtype: 'list',
loadingText: 'Chargement',
store: new Ext.data.Store({
model: 'Parking',
proxy: {
type: 'scripttag',
url : 'http://walker.hotcity.lu/hotcity-central-server/webresources/parking/json?format-version=1_0&client-type=iPhone',
reader: {
type: 'json',
root: 'remoteObject'




warning : Resource interpreted as Script but transferred with MIME type application/json.
error : Uncaught SyntaxError: Unexpected token :

Thank You.


4 May 2011, 5:32 PM
The Json Reader is choking on invalid Json. What's the response? You probably need to specify a different kind of reader (or no reader) or modify the returning json because...it's invalid json.

4 May 2011, 10:53 PM
I can use only two readers (ajax and scripttag). I tried with both, without reader but it still does not work.

Now, I tried with another web service and I have only the warning :
'warning : Resource interpreted as Script but transferred with MIME type application/json.'

Is it possible to recover data from JSON ?
Or, Sencha Touch only allows to retrieve data from JSON-P ?

4 May 2011, 10:56 PM
It's valid JSON allright, it's just not wrapped in a callback function. Depending on how you setup your app (and maybe even depending on what OS it will run) you could try simple Ajax instead. The cross domain request might simply be allowed on the device (but never when run in a desktop browser such as Safari or Chrome though)