I have problem by printing in the table, some JSON that is on the server. This is my JSON
process([
{
"name": "A",
"value": "41"
},
{
"name": "B",
"value": "71"
},
{
"name": "C",
"value": "20"
}],"2017.07.11 15:48:33");
My controller:
myApp.controller('liveTable', function ($scope, $http) {
$http.get('http://something.com/get.php?jsonp=2017')
.then(function (response) {
$scope.myData= response.data;
console.log(response.data);
});
And this is my HTML
<div class="liveTable" ng-controller="liveTable">
<table>
<tr ng-repeat="item in myData.process">
<td>{{item.name}}</td>
<td>{{item.value}}</td>
</tr>
</table>
</div>
Have any idea where I'm wrong? tnx
I think there is something wrong with your json data.
i can see by changing you json data. you can have a look on it.
Try:
For more information, see Not a Legal JSONP API
I am glad you were able to get the data with this answer. It shows that the server is not returning legal JSON. The server should be fixed to return either legal JSON or legal JSONP.
To make the server respond with a valid JSONP array, wrap the JSON in brackets () and prepend the callback:
For more information, see Simple PHP and JSONP example