2011-10-31 7 views
0

Je suis nouveau dans Sencha j'ai créécomment travailler avec sencha Php

var genres = new Ext.data.Store({ autoLoad: true, 
      proxy: { 
       url: '../www/App/stores/genres.php' 
       ,callbackKey: "callback" 
       , type:'ajax', 
       reader:{ 
         type:'json', 
         root:'rows' 
       }, 
       callback:function(data){ 
       alert(data);} 
      }, 
      fields:[{name:'ii',type: 'int'},{name:'genre_name',type:'string' }] 
      }); 

le fichier php crée un fichier JSON, mais je ne peux pas y accéder si je crée le fichier JSON au lieu, il fonctionne très bien ce qu'il faut faire ? help

Répondre

0

Avez-vous implémenté le callback sur le serveur php correctement? Comme ceci:

$callback = $_REQUEST['callback']; 

// Create the output object. 
$output = array('a' => 'Apple', 'b' => 'Banana'); 

//start output 
if ($callback) { 
    header('Content-Type: text/javascript'); 
    echo $callback . '(' . json_encode($output) . ');'; 
} else { 
    header('Content-Type: application/x-json'); 
    echo json_encode($output); 
}