0
Good night,
I’m trying to get php data through Angular.js but it’s not working. When I click on the category does not open the next page where the data will be shown.
PHP
<?php
    header('Content-Type: application/json');
    require_once("../funcoes/funcoes.php");
    $result = $conexao->prepare("SELECT * FROM colecoes WHERE menu = :menu AND activo = :activo ORDER BY pos ASC");
    $result->bindValue(':menu', 'Comer', PDO::PARAM_STR);
    $result->bindValue(':activo', 1, PDO::PARAM_INT);
    $result->execute();
    $rows = $result->fetchAll(PDO::FETCH_ASSOC);
    foreach ($rows as $row) {
        $result_anex = $conexao->prepare("SELECT * FROM colecoes_anexos WHERE id_mae = :row_id AND seccao = :seccao");
        $result_anex->bindParam(':row_id', $row['id'], PDO::PARAM_INT);
        $result_anex->bindValue(':seccao', 'thumbnail', PDO::PARAM_STR);
        $result_anex->execute();
        $row_anex = $result_anex->fetch(PDO::FETCH_ASSOC);
        echo json_encode($row);
    }
?>
Controlller
angular.module('starter.controllers', [])
.controller('comer_categorias', function($scope, $http) {
    $http.get("https://www.sabeonde.pt/api/api_categorias_comer.php").success(function (data) {
        $scope.comer = data;
    });
});
HTML
<ion-content ng-controller="comer_categorias">
    <h1 ng-repeat="comer_cat in comer">{{comer_cat.id}}</h1>
</ion-content>
Your request is probably being denied because it is for another domain. See http://answall.com/questions/12363/howto perform requisi%C3%A7%C3%B5es-ajax-com-jquery-em-dom%C3%Adnios-diferentes and http://answall.com/questions/3183/requisição-ajax-cross-domain-com-javascript-sem-apis
– bfavaretto