2012-09-11 5 views
0

imcha touch 개발에 새로운 기능이 추가되었습니다. 다른 도메인에있는 웹 서비스를 통해 json을 구문 분석한다고 가정하는 앱을 개발 중입니다.Sencha Touch 2.0에서 Json Response가 파싱되지 않았습니다.

여기에 json을 구문 분석하는 데 방해가됩니다. 제목, 저자 설명 링크 등의 이름을 가진 노드를 사용하면 완벽하게 작동합니다.

하지만 노드에 다른 이름을 사용하면 아무것도 표시되지 않습니다.

여기는 구문 분석하려는 json 응답입니다. m 잘못가는 곳

http://stassuet.byethost15.com/services/test/index.php

이 엽차의 응용 프로그램에서 응답을 구문 분석하고 어떤 메신저입니다 ..

Ext.define('GS.store.MyStore', { 
    extend: 'Ext.data.Store', 

    requires: [ 
     'GS.model.MainEvent', 
     'Ext.data.proxy.JsonP', 
     'Ext.data.proxy.Rest' 
     //'GS.util.JsonpX' 
    ], 

    config: { 
     autoLoad: true, 
     model: 'GS.model.MainEvent', 
     storeId: '55', 

     headers: { 
      "Accept": "text/xml" 
      //"access-control-allow-origin": "*", 
      //"Origin": "goodnews.pk", 
      //"Referer": "goodnews.pk" 
     }, 

     method: 'GET', 
     callbackKey: 'myFunction', 

     proxy: { 
      type: 'jsonp', 
      url: 'http://stassuet.byethost15.com/services/test/index.php', 

      reader: { 
       type: 'json', 
       rootProperty: 'albums.images' 
      } 
     } 
    } 
}); 

은 알려 주시기 바랍니다. 감사합니다.

답변

0

설정이 필요하지 않더라도 설정이 많은 것처럼 보입니다. 예를 들어 :

  • 헤더
  • 방법
  • callbackKey

은 이것에 대한 이유가 있나요?

어쨌든, 예상대로이 클래스를 사용하여 모든 부하 :

Ext.define('Example.store.SO', { 
    extend: 'Ext.data.Store', 

    config: { 
     autoLoad: true, 
     fields: [ 
      'name', 
      'author', 
      'last_modified' 
     ], 
     proxy: { 
      type: 'jsonp', 
      url: 'http://stassuet.byethost15.com/services/test/index.php', 
      reader: { 
       rootProperty: 'albums.images' 
      } 
     } 
    } 
}); 
+0

감사합니다 많이 .. 나를 위해 일! –