PDA

View Full Version : jsonp and Ext.data.ScriptTagProxy problems



camores
4 Oct 2012, 5:25 PM
Hi,
I have been trying to implement jsonp and Ext.data.ScriptTagProxy because I need to retrieve data from another domain, but it seems I am getting an error - Syntax error: invalid label.
The url I am accessing is this, http://projectlog.gosignmeup.com/portal-feed-server.asp?action=getfeed.
I have tested the returned json in http://json.parser.online.fr/ and the result is okay.

Model:
Ext.define('Actions', {
extend: 'Ext.data.Model',
idProperty: 'actionsid',
fields: [
{ name: 'changelogid', type: 'int' },
{ name: 'friendlyname', type: 'string' },
{ name: 'dateadded', type: 'date' },
{ name: 'changefiles', type: 'string' }
]
});
Datastore.
var store = Ext.create('Ext.data.Store',{
model: 'Actions',
autoLoad: false,
autoSync: true,
pageSize: 5,
remoteFilter: true,
remoteGroup: true,
remoteSort: true,
proxy: {
type: 'jsonp',
url: 'http://projectlog.gosignmeup.com/portal-feed-server.asp?action=getfeed',
reader: {
type: 'json',
root: 'feeds',
totalProperty: 'totalCount',
}
}
});

Below is the callback url.
http://projectlog.gosignmeup.com/portal-feed-server.asp?action=getfeed&_dc=1349399468119&page=1&start=0&limit=5&sort=[{"property"%3A"dateadded"%2C"direction"%3A"desc"}]&callback=Ext.data.JsonP.callback1

Could this be because there are commas returned in one of the json objects?

Any help is greatly appreciated.

Thanks.

vietits
4 Oct 2012, 7:12 PM
Accessing given url will return a text/html MIME type which is not valid for JsonP proxy. You should see section "Implementing on the server side" from Ext.data.proxy.JsonP (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.proxy.JsonP) API for more information.