0

I want my site to be able to retrieve steam item prices like below:

http://steamcommunity.com/market/priceoverview/?currency=3&appid=730&market_hash_name=Operation%20Phoenix%20Weapon%20Case

Right now i have this code:

$.ajax({
    type : "Get",
    url : "http://steamcommunity.com/market/priceoverview",
    data :"currency=3&appid=730&market_hash_name=" + steaminfo_inventory[3][index][7],
    dataType :"jsonp",
    jsonp: false,
    success : function(data){
        alert(data);},
});

I keep getting an error: Uncaught SyntaxError: Unexpected token :. It seems like i am still receiving the data, but i still get the error. When i click on the error in chrome i am seeing this output: {"success":true,"lowest_price":"0,06€","volume":"107,179","median_price":"0,06€ "}

Any help is appreciated Thanks.

1 Answers1

0

If you use JSONP, must set callback function in response. jQuery added automatically callback into get params.

Try change response on backend to GETcallback;

Example: Url -> http://steamcommunity.com/market/priceoverview/?currency=3&appid=730&market_hash_name=Operation%20Phoenix%20Weapon%20Case&callback=testCallback

Response -> testCallback({"success":true,"lowest_price":"0,06€","volume":"107,179","median_price":"0,06€ "});

dbucki
  • 454
  • 3
  • 7