I have problem receiving data from api with all other links it was ok but that one is so hard .. So here is the code
$.ajax({
url: 'proxy.php?url=https://na.api.pvp.net/observer-mode/rest/consumer/getSpectatorGameInfo/NA1/26667724?api_key=xxxx',
dataType:"json",
success: function() {
alert("Success");
},
error: function() {
console.log("Error")
}
});
And this is the php code that i am using .
<?php
header("Content-Type: text/javascript; charset=utf-8");
if (!isset($_GET['url'])) {
die();
}
$url = urldecode($_GET['url']);
$url = 'https://' . str_replace('https://', '', $url);
echo file_get_contents($url);
?>
On the console log is displayed --->XMLHttpRequest cannot load file:///D:/Install/xampp/htdocs/allInOne/proxy.php?url=https://na.api.pvp.n…pectatorGameInfo/NA1/26667724?api_key=xxx. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.send @ jquery-1.11.3.js:9664jQuery.extend.ajax @ jquery-1.11.3.js:9215jQuery.(anonymous function) @ jquery-1.11.3.js:9361jQuery.extend.getJSON @ jquery-1.11.3.js:9344renderInfo @ render.js:89onclick @ index.html:15 render.js:85 Error