title: Can't figure out why AngularJS doesn't read JSON from PHP
body: <p>I've spent hours trying to figure this out and browsing the web, but I must be doing something wrong. Every time i load the page it's just blank. 
  I'm trying to load the database from mysqli to angularjs.
  The code is copied exactly from W3 exercises so I have no idea where the problem is. </p>
  
  <p>dbaseread.php is in the same folder as the html.</p>
  
  <p>PHP:    </p>
  
  <pre><code> $query = "SELECT * FROM members";
      $result = $mysqli-&gt;query($query);
      $r = array();
      if( $result-&gt;num_rows&gt;0){
      while($row = $result-&gt;fetch_assoc()){
      $r[] = $row;
      }
      }
  
  
      $res = json_encode($r);
  
      header('Content-Type: application/json');
  
      echo $res;
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"&gt;&lt;/script&gt;
  &lt;body&gt;
  
  &lt;div ng-app="myApp" ng-controller="customersCtrl"&gt; 
  
  &lt;ul&gt;
    &lt;li ng-repeat="x in myData"&gt;
      {{ x.name }}
    &lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;/div&gt;
  
  &lt;script&gt;
  var app = angular.module('myApp', []);
  app.controller('customersCtrl', function($scope, $http) {
    $http.get("dbaseread.php").then(function (response) {
        $scope.myData = response.data.records;
    });
  });
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>