Jump to content

Welcome to Rune Tips, the first ever RuneScape help site. We aim to offer skill guides, quest guides, maps, calculators, informative databases, tips, and much more to help you get the most from the Massive Online Adventure Game, RuneScape, by Jagex Ltd © 2009.

Report Ad

Welcome to Forum.Tip.It
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

Error requesting data from tip.it highscores [JSON]


  • Please log in to reply
1 reply to this topic

#1
bluestreak22
[ Display Name History ]

bluestreak22

    Chicken Feather

  • Members
  • 1 posts
  • Gender:Not Telling
  • Joined:19 May 2017

I am trying to make a web application and currently am working on trying to get it to simply pull a users highscores from http://www.tip.it/runescape/json/hiscore_user?old_stats=1&rsn=RSNAME currently I have it reading the username properly but I am getting an error from the server get request

 

XMLHttpRequest cannot load http://services.runescape.com/m=hiscore_oldschool/index_lite.ws?player=zezima. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:10315' is therefore not allowed access.

 

Was wondering if someone could help me out?

 

function getUserData( RSname ) {
    var requestURL = "https://www.tip.it/runescape/json/hiscore_user?old_stats=1&rsn=",
        request = new XMLHttpRequest();
    request.open( "GET", requestURL + encodeURIComponent( RSname ) );
    // various sanitizations should be employed on the backend when dealing with user input
    request.responseType = "json";
    request.addEventListener( "readystatechange", function() {
        if ( request.readyState == 4 ) {
            if ( request.status == 200 ) {
                // process response
                var user_stats = request.response
                populateStatList();
            } else {
                alert(errormsg);
            }
        }
    }, false );
    request.send();
}

 



#2
skalexein
[ Display Name History ]

skalexein

    Chicken Feather

  • Members
  • 2 posts
  • Gender:Not Telling
  • Joined:3 September 2017

You need to use a backend langauge to do this such as PHP or C#. You cannot do it with javascript because of x-site scripting. That is why you are getting the access control origin.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users