Solved

Best Buy Remix API using JQuery

Posted on 2015-01-08
2
177 Views
Last Modified: 2015-01-08
I've created the following code, but now I need to show the results.  How do I do that?

    var apiKey = "zy5hzrxazsfe9f9uyehqpb5c";

    var storeLocation = params.id.split('|');

    var myURL = "http://api.remix.bestbuy.com/v1/stores(area(" + storeLocation[1] + "," + storeLocation[0] + "))?format=json&callback=?&apiKey=" + apiKey;

    $.ajax({
        type: "GET",
        url: myURL,
        cache: true,
        success: function () {
            alert('success');
        },
        dataType: 'json'
    });
0
Comment
Question by:Ray Turner
2 Comments
 
LVL 32

Accepted Solution

by:
Big Monty earned 500 total points
Comment Utility
add a variable to your success function:

   var apiKey = "zy5hzrxazsfe9f9uyehqpb5c";

    var storeLocation = params.id.split('|');

    var myURL = "http://api.remix.bestbuy.com/v1/stores(area(" + storeLocation[1] + "," + storeLocation[0] + "))?format=json&callback=?&apiKey=" + apiKey;

    $.ajax({
        type: "GET",
        url: myURL,
        cache: true,
        success: function ( results ) {
           // alert('success');
            alert(results)l);
        },
        dataType: 'json'
    });

Open in new window


that'll spit out all of the data that it received. Assuming it's in json, you can then parse it with jquerys parse function:

http://api.jquery.com/jquery.parsejson/
0
 

Author Closing Comment

by:Ray Turner
Comment Utility
Thanks!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now