I'm doing my api, in php, and I get the following warning
XMLHttpRequest can not load link . Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.
Here is the beginning of my php code:
<?php
header("Access-Control-Allow-Origin: *");
ini_set('display_errors', true);
error_reporting(E_ALL);
include_once("conexao.php");
$pdo = conectar();
$data = file_get_contents("php://input");
$data = json_decode($data);
$eh_profissional = $data->is_professional;
Follow my controller:
angular.module('servi.controllers', ['ngCordova'])
.controller('cadastroCtrl', ['$scope', '$stateParams', '$http',
$cordovaSQLite', '$window', '$state', function ($scope, $stateParams, $http,
$cordovaSQLite, $window, $state) {
$scope.email = [];
$scope.cadastrar = function(usuario){
$http.post("http://vigilantescomunitarios.com/serviapp/api_gustavo/register.php", usuario).success(function(response){
// http://vigilantescomunitarios.com/serviapp/api/register
})
}
}])
Does anyone know what the problem is? Thank you.