1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Cross-Origin usage of API now permitted

Discussion in 'Community Dev Corner' started by FliesLikeABrick, Sep 11, 2012.

Mods: Downburst, Mazey
  1. FliesLikeABrick

    FliesLikeABrick THD Team THD Team Administrator Global Moderator

    Messages:
    952
    I have made a small change to the API which permits cross-origin usage of the API. This means that - if for some reason you want to - you can now have browser-side javascript make calls to the API.

    Proof of concept code using jquery is at https://poc.kag2d.com/jquery-API/displayPlayers.html

    You can see that this makes a cross-origin call from poc.kag2d.com to api.kag2d.com (yes, they are under the same domain - but this works cross-domain too)

    Note that if the page is blank, that means that the server embedded in my code does not currently have any players. You can copy the html to your own computer/server with jquery and edit it to use any different server (just change the URL in the API call)
     
    LucasTT, Noburu and IamUndeadNub like this.
Mods: Downburst, Mazey