angularjs - Error on GET request to steam market -


i attempting request item price info single item on steam market.

here exact angularjs script using:

<script> var app = angular.module('csgo', []); app.controller('mainctrl', function($scope, $http) {     $http.jsonp("http://steamcommunity.com/market/priceoverview/?currency=3&appid=730&market_hash_name=stattrak%e2%84%a2%20p250%20%7c%20steel%20disruption%20%28factory%20new%29").success(function(response) {          $scope.values = response;         console.log(response);      }); }); </script> 

when try in browser get:

uncaught syntaxerror: unexpected token : ?currency=3&appid=730&market_hash_name=stattrak™ p250 | steel disruption (factory new):1 

inside chrome browser console. click link in error message (?currency=3&appid=730&market_hash_name=stattrak™ p250 | steel disruption (factory new):1)

and takes me line is:

{"success":true,"lowest_price":"1,09&#8364; ","volume":"348","median_price":"1,01&#8364; "} 

so information, gives error , underlines json response in red. know issue?

i using nodejs, express, , angular.

edit:

i tried different url: https://angularjs.org/greet.php?callback=json_callback&name=super%20hero

and worked url. im not sure why original url trying request not working. ideas on that?

when using jsonp, should call json_callback() process results. can refer angular jsonp document more information, provides live demo of how json_callback used.

so in case, should call below

$http.jsonp("http://steamcommunity.com/market/priceoverview/?callback=json_callback&currency=3&appid=730&market_hash_name=stattrak%e2%84%a2%20p250%20%7c%20steel%20disruption%20%28factory%20new%29").success(function(response) {      $scope.values = response;     console.log(response);  }); 

if server handle json_callback correctly, errors should gone.

update

i steam community

there lack of support jsonp protocol , api's acceptable usage policy requires api key not shared. described, using api key inside of javascript file (which downloaded in full source client) against policy valve has provided

they don't support jsonp, , don't support cors either. looks can access steam api angular.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -