battlenub
battlenub

Reputation: 187

Connecting to the runescape ge api

I'm trying to make requests to the Runescape GE Api using ajax/jquery

$(document).ready(function(){
$.ajax({
    url :'services.runescape.com/m=itemdb_rs/api/catalogue/category.json?category=1',
    dataType : 'json',
    success : function(res){
        $("#html").html(res);
    }
})
})

The request just turns red in firebug and i get CORS errors. How do i fix this?

Upvotes: 1

Views: 919

Answers (2)

JDong
JDong

Reputation: 2304

Yes, I think Anthony has it right. Running

$.get("http://services.runescape.com/m=itemdb_rs/api/catalogue/category.json?category=1", function(d){console.log(d);})

in the debugger on services.runescape.com returns the correct result, however using curl can fetch the result as well. The query fails when I run it on an external site such as stackoverflow. You will probably need to curl it, perhaps using PHP.

Upvotes: 0

Anthony Veach
Anthony Veach

Reputation: 320

Would CORS errors be related to cross-domain restrictions? If so, that could only be changed by the runescape.com server. An alternative is to make a local ajax call to a script that can then make cURL requests.

Upvotes: 1

Related Questions