0

Shopping API - JSON Issue

I am trying to pull my search data from the shopping api into JSON format and have been successful, however when I try to extract the data it says into an alert box it says undefined. I am severely frustrated with this and could really use some help. Here is my code, any help you can give me to get on the right track and successfully retrieve this data would be huge. Thanks

<html>
<head>
<title>Book Search</title>
</head>
</body>
<script type="text/javascript">
function ws_results(obj) {
eval(obj);
alert(obj.Categories.SubCategory.Title);
}
</script>
<script type="text/javascript" src="http://shopping.yahooapis.com/ShoppingService/v3/productSearch?appid=tSJmVLrV34Eji0sk8CsKEgSBhdoVgzsljRWXefyxQy72_xtiCTtwMi2qJuVWWt8-&query=9780596515782&output=json&callback=ws_results"></script>
<body></body>
</html>

by
2 Replies
  • Sorry it took us so long to get back to you, most of our team was out of the office at Open Hack Day NYC. You should take a look at the Shopping Group, you should be able to get some help there: http://tech.groups.yahoo.com/group/ydn-store/

    Thanks,
    Robyn
    0
  • The following code works for me. You do not need to eval the code as you are already passed a javascript object.

    CODE
    <html>
    <head>
    <title>Book Search</title>
    </head>
    </body>
    <script type="text/javascript">
    function ws_results(obj) {

    alert(obj.Categories.SubCategory[0].Title);

    }
    </script>
    <script type="text/javascript" src="http://shopping.yahooapis.com/ShoppingService/v3/productSearch?appid=tSJmVLrV34Eji0sk8CsKEgSBhdoVgzsljRWXefyxQy72_xtiCTtwMi2qJuVWWt8-&query=9780596515782&output=json&callback=ws_results"></script>
    <body></body>
    </html>
    0

Recent Posts

in General Discussion at YDN