Permalink
Browse files

Refresh bugs after adding new + loading state indication

  • Loading branch information...
samcroft committed Sep 29, 2012
1 parent 909ff62 commit 90287ba388d3871a50790e18d16aaafa1954eac0
Showing with 10 additions and 2 deletions.
  1. +10 −2 www/js/index.js
View
@@ -41,18 +41,26 @@ $(function(){
}
$('#add-bug form').submit(function(){
var loading = $(this).find('input[type="submit"]');
loading.addClass('loading');
var postData = $(this).serialize();
$.ajax({
type: 'POST',
data: postData,
url: 'http://localhost/bapp/add-bug.php',
success: function(data){
//do your thing
loadBugs();
$('#bugs').addClass('current');
$('#add-bug').removeClass('current');
loading.removeClass('loading');
console.log('Bug added!');
},
error: function(){
//do your thing
loading.removeClass('loading');
console.log('There was an error');
}
});

0 comments on commit 90287ba

Please sign in to comment.