From 509061f3cf240d699781bc2d0db8a1e8e8d49d5e Mon Sep 17 00:00:00 2001 From: Sam Croft Date: Thu, 27 Sep 2012 17:08:42 +0100 Subject: [PATCH] Load bugs ajax call --- www/js/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/www/js/index.js b/www/js/index.js index 6140331..6743517 100755 --- a/www/js/index.js +++ b/www/js/index.js @@ -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('
  • '+item.title) + }); + }, + error: function(data) { + bugs.append('
  • There was an error loading the bugs'); + } + }); + } + + loadBugs(); + +}); \ No newline at end of file