1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    2
    Vote Rating
    0
    santicano is on a distinguished road

      0  

    Default Answered: Jsonp: Unable to load data using the supplied configuration.

    Answered: Jsonp: Unable to load data using the supplied configuration.


    Hi,

    I am trying to use Jsonp Proxy to load data returned from a webserve, actually Joomla web site that provides a Web service that return JSON data:

    { "data": [ { "id" : "3", "params" : "", "name" : "Daniela", "last_name" : "Cano", "company" : "Ninguna", "ocupation" : "", "photo" : "", "mobile" : "316456789", "home" : "034456789", "homepage" : "", "mail" : "danielacano@hotmail.cm", "street" : "Cra. 49 · 61 sur 540 Bod 163", "city" : "Medellin", "country" : "Colombia", "zipcode" : "0", "birthday" : "2012-03-29", "notes" : "", "creation_date" : "2012-04-01", "modification_date" : "2012-04-01", "active" : "1", "user" : "0" }, { "id" : "4", "params" : "", "name" : "Fernando", "last_name" : "Ruiz", "company" : "Bomberos Sabaneta", "ocupation" : "", "photo" : "", "mobile" : "3004567898", "home" : "03478945612", "homepage" : "", "mail" : "ferruiz@hotmail.com", "street" : "", "city" : "Medellin", "country" : "Colombia", "zipcode" : "0", "birthday" : "0000-00-00", "notes" : "", "creation_date" : "2012-04-12", "modification_date" : "2012-04-12", "active" : "1", "user" : "0" }, { "id" : "2", "params" : "", "name" : "Maritza", "last_name" : "Benjumea", "company" : "Vivatecno", "ocupation" : "", "photo" : "", "mobile" : "3164467857", "home" : "0343069084", "homepage" : "www.vivatecno.com", "mail" : "maritza.benjumea@vivatecno.com", "street" : "Cra. 49 · 61 sur 540 Bod 163", "city" : "Medellin", "country" : "Colombia", "zipcode" : "0", "birthday" : "1972-02-27", "notes" : "", "creation_date" : "2012-04-01", "modification_date" : "2012-04-01", "active" : "1", "user" : "0" }, { "id" : "5", "params" : "", "name" : "Natalia ", "last_name" : "Benjumea", "company" : "Kerathin Express", "ocupation" : "", "photo" : "", "mobile" : "17476616515", "home" : "17465151511", "homepage" : "", "mail" : "nabenva@yahoo.com", "street" : "", "city" : "Las Vegas", "country" : "USA", "zipcode" : "33456", "birthday" : "0000-00-00", "notes" : "", "creation_date" : "2012-04-18", "modification_date" : "2012-04-18", "active" : "1", "user" : "0" }, { "id" : "1", "params" : "", "name" : "Santiago", "last_name" : "Cano", "company" : "Vivatecno", "ocupation" : "", "photo" : "", "mobile" : "3164467860", "home" : "0343069084", "homepage" : "www.vivatecno.com", "mail" : "santiago.cano@vivatecno.com", "street" : "Cra. 49 · 61 sur 540 Bod 163", "city" : "Medellin", "country" : "Colombia", "zipcode" : "0", "birthday" : "1972-02-26", "notes" : "", "creation_date" : "2012-04-01", "modification_date" : "2012-04-01", "active" : "1", "user" : "42" } ] }

    This is my proxy:
    Ext.define('Movies.model.Resource', {
    extend: 'Ext.data.Model',
    config: {
    fields: [
    {
    name: 'titles',
    type: 'string'
    }
    ],
    proxy: {
    type: 'jsonp',
    url: 'http://salons.vivatecno.com/index.php?option=com_hairdressers&controller=json_x&fileout=yes&format=raw&task=get_adm_clients&usr=admn&pwd=cha9511',
    reader: {
    type: 'json',
    rootProperty: 'data'
    }
    }
    }
    });

    When I try to load data , I get and error:
    SyntaxError: Parse error

    When I use the webservice I get the JSON with no problem, I`ve validate the JSON code and seem to be OK.

    Any Clue????

  2. You are using jsonp which requires a jsonp response. A jsonp response is json wrapped in a callback method. The callback method's name is passed in the callback param in the request.

    If callback param = 'Ext.data.JsonP.callback01' then the expected response for you would be

    Code:
    Ext.data.JsonP.callback01({ "data": [ { "id" :	"3", "params" :	"", "name" :	"Daniela", "last_name" :	"Cano", "company" :	"Ninguna", "ocupation" :	"", "photo" :	"", "mobile" :	"316456789", "home" :	"034456789", "homepage" :	"", "mail" :	"danielacano@hotmail.cm", "street" :	"Cra. 49 · 61 sur 540 Bod 163", "city" :	"Medellin", "country" :	"Colombia", "zipcode" :	"0", "birthday" :	"2012-03-29", "notes" :	"", "creation_date" :	"2012-04-01", "modification_date" :	"2012-04-01", "active" :	"1", "user" :	"0" }, { "id" :	"4", "params" :	"", "name" :	"Fernando", "last_name" : "Ruiz", "company" :	"Bomberos Sabaneta", "ocupation" :	"", "photo" :	"", "mobile" :	"3004567898", "home" :	"03478945612", "homepage" :	"", "mail" :	"ferruiz@hotmail.com", "street" :	"", "city" :	"Medellin", "country" :	"Colombia", "zipcode" :	"0", "birthday" : "0000-00-00", "notes" :	"", "creation_date" :	"2012-04-12", "modification_date" :	"2012-04-12", "active" :	"1", "user" :	"0" }, { "id" :	"2", "params" :	"", "name" :	"Maritza", "last_name" :	"Benjumea", "company" :	"Vivatecno", "ocupation" :	"", "photo" :	"", "mobile" : "3164467857", "home" :	"0343069084", "homepage" :	"www.vivatecno.com", "mail" :	"maritza.benjumea@vivatecno.com", "street" : "Cra. 49 · 61 sur 540 Bod 163", "city" :	"Medellin", "country" :	"Colombia", "zipcode" :	"0", "birthday" :	"1972-02-27", "notes" :	"", "creation_date" :	"2012-04-01", "modification_date" :	"2012-04-01", "active" :	"1", "user" :	"0" }, { "id" :	"5", "params" :	"", "name" : "Natalia ", "last_name" :	"Benjumea", "company" :	"Kerathin Express", "ocupation" :	"", "photo" :	"", "mobile" :	"17476616515", "home" :	"17465151511", "homepage" :	"", "mail" :	"nabenva@yahoo.com", "street" :	"", "city" :	"Las Vegas", "country" :	"USA", "zipcode" :	"33456", "birthday" :	"0000-00-00", "notes" :	"", "creation_date" :	"2012-04-18", "modification_date" :	"2012-04-18", "active" :	"1", "user" :	"0" }, { "id" :	"1", "params" :	"", "name" :	"Santiago", "last_name" :	"Cano", "company" :	"Vivatecno", "ocupation" :	"", "photo" :	"", "mobile" :	"3164467860", "home" :	"0343069084", "homepage" :	"www.vivatecno.com", "mail" : "santiago.cano@vivatecno.com", "street" :	"Cra. 49 · 61 sur 540 Bod 163", "city" :	"Medellin", "country" :	"Colombia", "zipcode" :	"0", "birthday" :	"1972-02-26", "notes" :	"", "creation_date" :	"2012-04-01", "modification_date" :	"2012-04-01", "active" :	"1", "user" :	"42" } ] });
    Notice the before and after the json parts.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    Answers
    3574
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You are using jsonp which requires a jsonp response. A jsonp response is json wrapped in a callback method. The callback method's name is passed in the callback param in the request.

    If callback param = 'Ext.data.JsonP.callback01' then the expected response for you would be

    Code:
    Ext.data.JsonP.callback01({ "data": [ { "id" :	"3", "params" :	"", "name" :	"Daniela", "last_name" :	"Cano", "company" :	"Ninguna", "ocupation" :	"", "photo" :	"", "mobile" :	"316456789", "home" :	"034456789", "homepage" :	"", "mail" :	"danielacano@hotmail.cm", "street" :	"Cra. 49 · 61 sur 540 Bod 163", "city" :	"Medellin", "country" :	"Colombia", "zipcode" :	"0", "birthday" :	"2012-03-29", "notes" :	"", "creation_date" :	"2012-04-01", "modification_date" :	"2012-04-01", "active" :	"1", "user" :	"0" }, { "id" :	"4", "params" :	"", "name" :	"Fernando", "last_name" : "Ruiz", "company" :	"Bomberos Sabaneta", "ocupation" :	"", "photo" :	"", "mobile" :	"3004567898", "home" :	"03478945612", "homepage" :	"", "mail" :	"ferruiz@hotmail.com", "street" :	"", "city" :	"Medellin", "country" :	"Colombia", "zipcode" :	"0", "birthday" : "0000-00-00", "notes" :	"", "creation_date" :	"2012-04-12", "modification_date" :	"2012-04-12", "active" :	"1", "user" :	"0" }, { "id" :	"2", "params" :	"", "name" :	"Maritza", "last_name" :	"Benjumea", "company" :	"Vivatecno", "ocupation" :	"", "photo" :	"", "mobile" : "3164467857", "home" :	"0343069084", "homepage" :	"www.vivatecno.com", "mail" :	"maritza.benjumea@vivatecno.com", "street" : "Cra. 49 · 61 sur 540 Bod 163", "city" :	"Medellin", "country" :	"Colombia", "zipcode" :	"0", "birthday" :	"1972-02-27", "notes" :	"", "creation_date" :	"2012-04-01", "modification_date" :	"2012-04-01", "active" :	"1", "user" :	"0" }, { "id" :	"5", "params" :	"", "name" : "Natalia ", "last_name" :	"Benjumea", "company" :	"Kerathin Express", "ocupation" :	"", "photo" :	"", "mobile" :	"17476616515", "home" :	"17465151511", "homepage" :	"", "mail" :	"nabenva@yahoo.com", "street" :	"", "city" :	"Las Vegas", "country" :	"USA", "zipcode" :	"33456", "birthday" :	"0000-00-00", "notes" :	"", "creation_date" :	"2012-04-18", "modification_date" :	"2012-04-18", "active" :	"1", "user" :	"0" }, { "id" :	"1", "params" :	"", "name" :	"Santiago", "last_name" :	"Cano", "company" :	"Vivatecno", "ocupation" :	"", "photo" :	"", "mobile" :	"3164467860", "home" :	"0343069084", "homepage" :	"www.vivatecno.com", "mail" : "santiago.cano@vivatecno.com", "street" :	"Cra. 49 · 61 sur 540 Bod 163", "city" :	"Medellin", "country" :	"Colombia", "zipcode" :	"0", "birthday" :	"1972-02-26", "notes" :	"", "creation_date" :	"2012-04-01", "modification_date" :	"2012-04-01", "active" :	"1", "user" :	"42" } ] });
    Notice the before and after the json parts.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    2
    Vote Rating
    0
    santicano is on a distinguished road

      0  

    Default


    That solves the problem.

    Thanks for your reply.

Thread Participants: 1

Tags for this Thread