1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    9
    Vote Rating
    0
    LukeSkywalkman is on a distinguished road

      0  

    Default Answered: Problem with JSONP proxy

    Answered: Problem with JSONP proxy


    Hi,

    Im having problem with load data from json file placed on other server.
    Here's my code:
    PHP Code:
    Ext.define('Tasty.store.Categories'
    {    
    extend'Ext.data.Store',    
    requires:['Ext.data.proxy.JsonP'],    
    config: {        
    model:'Tasty.model.Categories',       
     
    autoLoadtrue,       
     
    proxy:{           
     
    type:'scripttag',            
    url:'http://www.upmenu.pl/api/v1/menu/productGroups/7/9/f42286f7-df2d-11e1-a35c-00163edcb8a0'
              
    reader:{               
     
    type:'json',            
    },            
    callbackKey:'callback',        
    }   
     }}); 
    model:
    PHP Code:
    Ext.define('Tasty.model.Categories', {    
    extend'Ext.data.Model',        
    config: {        
    fields: [            
    {
    name'name'type'auto'},            
    {
    name'id'type'auto'},            
    {
    name'desription'type'string'},            
    {
    name'iconUrl'type'auto'},           
     {
    name'imageUrl'type:  'auto'},            
    {
    name'types'type:  'auto'},            
    {
    name'products'type:  'auto'}        ]    
    }}); 
    and response from server:
    PHP Code:
    [{"id":"2d99a361-df39-11e1-a35c-00163edcb8a0","name":"Pizza","description":"do wszystkich pizzy na wynos dodajemy sosy: pomidorowy i czosnkowy","types":[],"iconUrl":null,"imageUrl":null,"products":[]},{"id":"dcb21ee4-df98-11e1-a35c-00163edcb8a0","name":"Dodatki do pizzy","description":"","types":[],"iconUrl":null,"imageUrl":null,"products":[]},{"id":"c410851d-df96-11e1-a35c-00163edcb8a0","name":"Dania obiadowe","description":"wszystkie zestawy serwowane z kompotem dnia","types":[],"iconUrl":null,"imageUrl":null,"products":[]},{"id":"6a32f65e-df99-11e1-a35c-00163edcb8a0","name":"Dodatki obiadowe","description":"","types":[],"iconUrl":null,"imageUrl":null,"products":[]},{"id":"6ee1bb73-df98-11e1-a35c-00163edcb8a0","name":"Napoje","description":"","types":[],"iconUrl":null,"imageUrl":null,"products":[]}] 
    and when i changed proxy type to ajax and read json from local file it loaded it properly...

    Anyone knows solution?

  2. The server side needs to support your jsonp request. If you do not control the server side, you will need to reference the server-side API for jsonp requests or figure it out by trial and error. I believe the sencha touch 2 twitter example provides a good client-side reference implementation for jsonp. You may want to take a look at that example.

  3. #2
    Sencha User
    Join Date
    Apr 2011
    Posts
    212
    Answers
    3
    Vote Rating
    4
    bweiler is on a distinguished road

      0  

    Default


    The server side needs to support your jsonp request. If you do not control the server side, you will need to reference the server-side API for jsonp requests or figure it out by trial and error. I believe the sencha touch 2 twitter example provides a good client-side reference implementation for jsonp. You may want to take a look at that example.

  4. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    9
    Vote Rating
    0
    LukeSkywalkman is on a distinguished road

      0  

    Default


    thanka for the advice

    problem seems to be solved now

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar