I am using the following code to do a http request.
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<!--head_end-->
</head>
<body>
<div class="company_profile" ng-app="company_profile" ng-controller="company_profileCtrl">
<h2>&company_name</h2>
<p><a href="&company_link" target="_blank" rel="nofollow">&company_link_text</a>
</p>
<p>{{companyProfile}}</p>
</div>
<!-- populate company_profile -->
<script>
var app = angular.module('company_profile', []);
app.controller('company_profileCtrl', function($scope, $http) {
$http.get("single-site.php").then(function(response) {
$scope.companyProfile = response.data;
});
});
</script>
</body>
</html>
However the code returns the source code of the html document it is in.
the single-site.php file exists and returns json data.
Thanks for your help
Edit I saw three other questions of people who had this problem, but none of them was correctly resolved.
console.log(response.data)and probably this can help you link$scope.companyProfile = response.data.companyProfilebut with angularjs and pretty url, you must be carefully