Ajax call to steamweb api

hi guys we are trying to get our users stats from the steamWeb api using ajax
I am having difficulty getting the script to work as with CORS cross domain.

 <script type="text/javascript">
        $.ajax({
            url: "http://api.steampowered.com/ISteamUser/GetFriendList/v0001/?key=xxxxxxxxxxxxxxxxxxxx&steamid=76561197960435530&relationship=friend",
            dataType: "json",
            success: function(data){
                console.log(data);
            },
             headers: {"Access-Control-Allow-Origin":"*"},
            error: function(req,text,error){
                console.log(text);
                console.log(error);
                console.log("DIDN'T WORK!")
            }
        });
    </script>

Using the log on Chrome i can see this error

XMLHttpRequest cannot load http://api.steampowered.com/ISteamUser/GetFriendList/v0001/?key=31xxxxxxxxxx0&steamid=76561197960435530&relationship=friend. Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://evo4ever.me’ is therefore not allowed access. The response had HTTP status code 500.

we have added


<filter> 
  <filter-name>CorsFilter</filter-name> 
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class> 
  <init-param> 
    <param-name>cors.allowed.origins</param-name> 
    <param-value></param-value> 
  </init-param> 
  <init-param> 
    <param-name>cors.allowed.methods</param-name> 
    <param-value>GET,POST,PUT</param-value> 
  </init-param> 
  <init-param> 
    <param-name>cors.allowed.headers</param-name> 
    <param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value> 
  </init-param> 
  <init-param> 
    <param-name>cors.exposed.headers</param-name> 
    <param-value></param-value> 
  </init-param> 
  <init-param> 
    <param-name>cors.support.credentials</param-name> 
    <param-value>true</param-value> 
  </init-param> 
  <init-param> 
    <param-name>cors.preflight.maxage</param-name> 
    <param-value>180</param-value> 
  </init-param> 
</filter> 
<filter-mapping> 
  <filter-name>CorsFilter</filter-name> 
  <url-pattern>/*</url-pattern> 
</filter-mapping>

to the webXML but we still seem to not be allowed to do this.

Burning my head out i think the way the headers are done is the issue but i dont seem to be able to figure it out any help would be much appreciated.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.