mardi 27 février 2018

When i try to get my JSON Object from the link, i am getting a error: No 'Access-Control-Allow-Origin' header is present on the requested resource [duplicate]

The complete error:

Failed to load https://euw1.api.riotgames.com/lol/summoner/v3/summoners/by-name/joe0802?api_key=*****-********-****-****-****-************: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:58631' is therefore not allowed access.

I am using ASP.net to create a Analytics-Site...

My Webpage code:

@{
    ViewBag.Title = "Home Page";
}
<script src="~/Scripts/request.js"></script>
<script src="~/Scripts/jquery-1.10.2.min.js"></script>

<div class="row">
   <button onclick="getSummoner()">GET</button>

    <p id="result" />
</div>

My JS for the JSON request:

function getSummoner() {
    $.getJSON('https://euw1.api.riotgames.com/lol/summoner/v3/summoners/by-name/joe0802?api_key=RGAPI-80f8d1ee-cbc6-4a34-9a62-bd0429749221', function (data) {
        window.alert(data);
    }

    );

}




Aucun commentaire:

Enregistrer un commentaire