How to read JSON from an API with jQuery?

I’m trying to get statistics from sendgrid by using getJSON(). Their JSON feed reads:


[{"date":"2009-06-20",
"requests":12342,
"bounces":12,
"clicks":10223,
"opens":9992,
"spamreports":5,
"unique_clicks":3,
"unique_opens":6,
"blocked":7},

{"date":"2009-06-21",
"requests":32342,
"bounces":10,
"clicks":14323,
"opens":10995,
"spamreports":7,
"unique_clicks":3,
"unique_opens":9,
"blocked":4},

{"date":"2009-06-22",
"requests":52342,
"bounces":11,
"clicks":19223,
"opens":12992,
"spamreports":2,
"unique_clicks":5,
"unique_opens":2,
"blocked":8}]

This is the jquery code to render it into the browser, but nothing is showing up?


$(document).ready(function(){
var stats =
"https://sendgrid.com/api/stats.get.jsonapi_user=youremail@domain.com&api_key=secureSecret&days=2"
	
	$.getJSON(stats, function(key, value) {
		$('<ul>', {
		    id : 'sg_stats',
		    html : '<li> ' + key + '</li><li>' + value '</li>'
		})
	});	
});

Sendgrid is the feed I’m trying to access, should I put wrap this in an ajax call instead?
Isn’t this a type of AJAX call anyways?
Am I missing something else in my code?

Please have a read of the jQuery documentation as your currently using your anonymous function incorrectly.

http://api.jquery.com/jQuery.getJSON/


$.getJSON("test.js", function(json) {
    $.each(json, function(){
        alert(this.date);
    });
 });