Created
August 4, 2011 04:25
-
-
Save elijahmanor/1124506 to your computer and use it in GitHub Desktop.
Find the jQuery Bug #1: Timing - Problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zebraTable(); | |
$( ".delete" ).bind( "click", function() { | |
var $this = $( this ), | |
$row = $this.closest( "tr" ), | |
rowId = $row.attr( "id" ); | |
$.ajax({ | |
url: "/Contact/Delete/" + rowId, | |
type: "POST", | |
success: function( data, textStatus, jqXHR ) { | |
if ( data.status === "success" ) { | |
$row.hide( 500, function() { | |
$row.remove(); | |
}); | |
} else { | |
console.log( data.message ); | |
} | |
}, | |
error: function( jqXHR, textStatus, errorThrown ) { | |
console.log( "error", textStatus ); | |
}, | |
complete: function( jqXHR, textStatus ) { | |
zebraTable(); | |
} | |
}); | |
}); | |
function zebraTable() { | |
$( "tr" ).removeClass( "odd" ) | |
.filter( ":odd" ).addClass( "odd" ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment