I'm trying to access a web service that gets in the Header "Device" and Body "User and Password", it returns me json in this format:
{
"IdUsuario": 2,
"Usuario": "Fulanu",
"Token": "1f7b87d7"
}
Trying to do this in angle, follow my code:
$scope.logar = function (){
var data = ({Usuario: "usu",Senha:"sen"});
var config = {
headers : {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;',
'data': {Device:"1"}
}
}
$http.post("URL", data,config).success(function(data, status){
console.log(data);
});
};
This is returning me following error:
XMLHttpRequest can not load. Response to preflight request does not pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.