| 1 |
/* |
| 2 |
* To change this template, choose Tools | Templates |
| 3 |
* and open the template in the editor. |
| 4 |
*/ |
| 5 |
|
| 6 |
|
| 7 |
jQuery(document).ready(function($){ |
| 8 |
//Do Ajax Message Delete |
| 9 |
$('.wpg-message a.delete').click(function(e){ |
| 10 |
e.preventDefault(); |
| 11 |
var tr = $(this).parents('tr'); |
| 12 |
if(confirm(WPG.deleteConfirm)){ |
| 13 |
$.post(WPG.endpoint, { |
| 14 |
action: WPG.action, |
| 15 |
_wpnonce: WPG.nonce, |
| 16 |
post_id: $(this).attr('href').replace(/[^0-9]/g, '') |
| 17 |
}, function(response){ |
| 18 |
if(response.status == true){ |
| 19 |
tr.fadeOut('normal', function(){ |
| 20 |
$(this).remove(); |
| 21 |
if($('.wpg-message tr').length < 1){ |
| 22 |
$('.wpg-message table').replaceWith('<p>' + WPG.deleteComplete + '</p>'); |
| 23 |
} |
| 24 |
}); |
| 25 |
}else{ |
| 26 |
alert(WPG.deleteFailed); |
| 27 |
} |
| 28 |
}); |
| 29 |
} |
| 30 |
}); |
| 31 |
}); |