Bonjour à tous,
j'ai un problème pour récupéré la valeur d'un Json.
J'utilise ces infos habituellement dans un grid via extjs.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 // Execution de la requête $sth = $dbh->query($req); $result = $sth->fetchAll(PDO::FETCH_ASSOC); if($result) { // On récupère la liste des tickets foreach($result as $data) { $ticket = array('noAppel' => htmlentities($data['noAppel']), 'dateAppel' => $data['dateAppel'], 'dateCloture' => $data['dateCloture'], 'statut' => htmlentities($data['statut']), 'technologie' => htmlentities($data['technologie']), 'POP' => htmlentities($data['POP']), 'dept' => htmlentities($data['dept']), 'Criticite' => htmlentities($data['Criticite']), 'Symptome' => htmlentities($data['Symptome']), 'signalisation' => htmlentities($data['signalisation']), 'x' => htmlentities($data['latitude']), 'y' => htmlentities($data['longitude'])); $ret['ticket'][] = $ticket; $ret['total'] = $data['Total']; } } // Deconnexion de la base de donnees $dbh = null; echo json_encode($ret);
Mais je souhaiterais récupéré mon Json tout bêtement dans un autre fichier en appelant mon Json sans passer par extjs.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 // Store des tickets en cours var stoTicketsClos = new Ext.data.Store({ storeId: 'stoTicketsClos', url: 'data/incidents/getTicketsBackbone.php', remoteSort: true, autoLoad: true, method: 'POST', baseParams: { rechDate: '', rechNumero: '', rechCriticite: '', rechPop: '', rechStatut: '', statut: 'C', depts: listeDepts, sort: '', dir: 'ASC', start: 0, limit: 20, total: 0 }, reader: new Ext.data.JsonReader({ totalProperty: 'total', root: 'ticket' }, new Ext.data.Record.create([ {name: 'noAppel', type: 'int'}, {name: 'dateAppel', type: 'date'}, {name: 'dateCloture', type: 'date'}, {name: 'statut', type: 'string'}, {name: 'technologie', type: 'string'}, {name: 'POP', type: 'string'}, {name: 'dept', type: 'string'}, {name: 'Criticite', type: 'string'}, {name: 'signalisation', type: 'string'}, {name: 'Symptome', type: 'string'}, {name: 'x', type: 'decimal'}, {name: 'y', type: 'decimal'} ]) ) });
J'espère avoir été clair pour mon souci.
Partager