I am trying to write a Jquery to Parse product information from an api.
<div id="placeholder"></div>
script....
$.getJSON(data);
var output = "<ul>";
for (var i in data.products) {
output += "<li>" + data.products[i].sku + " " + data.products[i].name + "--" +
data.products[i].salePrice + "</li>";
}
output += "</ul>";
document.getElementById("placeholder").innerHTML = output;`
when I give var data = {"products":[{"id_item":12324,"id_name":"canon"} it works but if I pass a link var data = "http://api.remix.bestbuy.com/v1/products(manufacturer=canon&salePrice%3C1000)?format=json&show=sku,name,salePrice&apiKey=<API_KEY> it does not work. I am a beginner and trying to learn JQUERY. Any kind of help will be appreciated...Is there any code debugger for Jquery... Thanks in advance...
getJSON, as described here: api.jquery.com/jQuery.getJSON. The passed URL will be fetched, and then once the URL is fetched, jQuery will call the callback function, the the fetched data as an argument.