Good evening, I'm trying to make an access from my local machine to a server and I'm getting this response:
No Access-Control-Allow-Origin header is present on the requested resource. Origin ' link ' is therefore not allowed access.
But using Postman I can - these are the server requirements:
// Estes cabecalhos sao necessarios no CORS
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT');
My code:
$('form').submit(function(e){
e.preventDefault();
var submit = true;
if( submit )
var form = $(this).serialize();
$.ajax({
url: url,
data: form,
dataType: 'json',
success: function(data) {
console.log(data);
},
type: 'POST'
});
return false;
});
Someone gives me a light!