I need to make a JSON request for PayU, but it shows me the message:
Cross-origin request blocked: Same source policy (Same Origin Policy) prevents the remote resource from being read a a % 5D = 22222222 "> link . (Reason: CORS 'Access-Control-Allow-Origin' header is not present).
JS
var data = {
"test": false,
"language": "en",
"command": "PING",
"merchant": {
"apiLogin": "1111111",
"apiKey": "22222222"
}
};
$.ajax({
url: "https://sandbox.api.payulatam.com/payments-api/4.0/service.cgi",
method: 'GET',
dataType:'json',
headers: {
'Content-Type': 'application/json',
},
data: data,
success: function(data) {
console.log('ok');
console.log(data);
}
});
I tried to put the following code in the header, but it still does the same thing:
'Access-Control-Allow-Origin': '*'
I've tried other similar questions, but none helped.