supermishboy
supermishboy

Reputation: 99

Get information in JSON format from steam page, using jquery

I have found a lot of information about that, but it still doesn't work :/

So I have this steam page in JSON format and I want to get lowest_price variable w/o PHP because I'm using it for my chrome extension. Help me, please.

Upvotes: 1

Views: 311

Answers (1)

Kit Sunde
Kit Sunde

Reputation: 37085

fetch("https://steamcommunity.com/market/priceoverview/?currency=5&appid=570&market_hash_name=Huntling").then(function(response){
  return response.json();
}).then(function(response){
  console.log(response.lowest_price);
});

Or since you're using jQuery:

$.get("https://steamcommunity.com/market/priceoverview/?currency=5&appid=570&market_hash_name=Huntling", function(response){
  console.log(response.lowest_price);
});

If you're making an extension you need to configure it for CORS in the manifest: https://developer.chrome.com/extensions/xhr#requesting-permission Something like this:

{
  "name": "My extension",
  ...
  "permissions": [
    "https://steamcommunity.com/*"
  ],
  ...
}

Upvotes: 1

Related Questions