As you are switching class and selector relative to hanlder is not re-evaluated, you should delegate event, e.g:
$(document.body).on('click','.orderHideBtn',function(){
var $oid = this.id.split('-');
$data = 'a=hideOrder&oid='+$oid[1];
$.ajax({
data: $data,
success: function(msg){
$('#hbtn-'+$oid[1]).toggleClass("orderHideBtn orderShowBtn").toggleClass('icon-eye-close icon-eye-open').closest('tr').appendTo('#ordersTBody2');
console.log('#hbtn-'+$oid[1]);
}
});
});
I removed detach() method because, as i'm aware of, it is useless here.