Permalink
Browse files

Load bugs ajax call

  • Loading branch information...
1 parent bc265c4 commit 509061f3cf240d699781bc2d0db8a1e8e8d49d5e @samcroft committed Sep 27, 2012
Showing with 25 additions and 0 deletions.
  1. +25 −0 www/js/index.js
View
@@ -18,3 +18,28 @@ var app = {
completeElem.className = completeElem.className.split('hide').join('');
}
};
+
+$(function(){
+
+ function loadBugs() {
+ var bugs = $('#bugs ul');
+
+ $.ajax({
+ type: 'GET',
+ url: 'http://localhost/bapp/bugs.php?&jsoncallback=?',
+ dataType: 'JSONp',
+ timeout: 5000,
+ success: function(data) {
+ $.each(data, function(i,item){
+ bugs.append('<li>'+item.title)
+ });
+ },
+ error: function(data) {
+ bugs.append('<li>There was an error loading the bugs');
+ }
+ });
+ }
+
+ loadBugs();
+
+});

0 comments on commit 509061f

Please sign in to comment.