yoak négligemment lourd | Par la route, mon problème est pas résoudu
Disclaimer : les noms/emplacements des fichiers ainsi que le code sont dégueu, mais, c'est du cafouillage, en ce moment
je vous mets le code :
index2.html
Code :
- <html>
- <head>
- <meta charset="utf-8">
- <title>Angular.js JSON Fetching Example</title>
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
- <!--<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>-->
- <script src="angular-1.5.2/angular.min.js"></script>
- <script>
- var UserInfo = angular.module('UserInfo', []);
- UserInfo.controller('UserInfoCtrl', function ($scope, $http) {
- $http.get('Controllers/users.json')
- .success(function(data) {
- $scope.names = data;
- });
- });
- </script>
- </head>
- <body ng-app= "UserInfo" ng-controller="UserInfoCtrl">
- <table>
- <tr>
- <th>users_login</th>
- <th>users_name</th>
- <th>users_fname</th>
- </tr>
- <tr ng-repeat="x in names">
- <td>{{ x.users_login }}</td>
- <td>{{ x.users_name }}</td>
- <td>{{ x.users_fname }}</td>
- </tr>
- </table>
- </body>
- </html>
|
init.php
Code :
- <?php
- include 'functions.php';
- session_start();
- //print $_SESSION['login'];
- If(!isset($_SESSION['login']))
- {
- header('Refresh: 0;URL=error.html');
- }
- $donnees = sql_request('SELECT * FROM users', 1);
- header('Content-Type: application/json');
- echo json_encode($donnees);
- ?>
|
si je fais pointer sur Controllers/users.json, ca marche
contenu du fichier :
Code :
- [{"users_id":"1","0":"1","users_login":"user1","1":"user1","users_fname":"pnom","2":"pnom","users_name":"nom","3":"nom","users_password":"toto","4":"toto","users_status":"0","5":"0"},{"users_id":"2","0":"2","users_login":"toto.tata","1":"toto.tata","users_fname":"tata","2":"tata","users_name":"toto","3":"toto","users_password":"1234","4":"1234","users_status":"1","5":"1"}]
|
et si je pointe sur init.php, ca marche pas
rendu du fichier init dans une page web :
Code :
- [{"users_id":"1","0":"1","users_login":"user1","1":"user1","users_fname":"pnom","2":"pnom","users_name":"nom","3":"nom","users_password":"toto","4":"toto","users_status":"0","5":"0"},{"users_id":"2","0":"2","users_login":"toto.tata","1":"toto.tata","users_fname":"tata","2":"tata","users_name":"toto","3":"toto","users_password":"1234","4":"1234","users_status":"1","5":"1"}]
|
J'ai rajouté le header suite a ton post, gatsu. |