Skip to content

Instantly share code, notes, and snippets.

@giupo
Created December 18, 2012 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giupo/4329480 to your computer and use it in GitHub Desktop.
Save giupo/4329480 to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>
<table id="mytable">
</table>
<script>
var d = null;
$.ajax({
url: '<url>',
type: 'GET',
dataType: 'json',
success: function(data, textStatus, xhr) {
var table = $('table#mytable');
table.empty()
var html = $.map(data, function(element, index) {
return "<tr>"+
"<td>" + element["sent"] + "</td>"+
"<td>" + element["error_description"] + "</td>"+
"<td>" + element["to"] + "</td>"+
"<td>" + element["cc"] + "</td>"
"</tr>";
});
table.html(html.join(""));
},
error: function(xhr, textStatus, errorThrown) {
//handle error
}
});
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment