下面小编就为大家带来一篇jQuery ajax 中使用confirm ,确认是否删除的简单实例。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
jQuery ajax 中使用confirm ,确认是否删除按钮 onclick="return confirm('确认删除?');"
<script type="text/javascript"> $(function(){ $("#btnDelete").click(function(){ //var user8ID = $.trim( $('#user8ID').val() ); var statu = confirm("Are you sure to delete the current data?"); if(!statu){ return false; } var operation = '8IDdelete'; $.ajax({ type:'POST', url:'backendUserModuleMapping.php?stamp='+new Date().getTime(), data:'operation='+operation+'&'+$("form").eq(1).serialize(), success:function(msg){ if(msg == 1){ alert( 'Delete Successful!' ); location.reload(); }else{ alert( 'Delete Failed!' ); } }, error:function(){ alert( 'Delete Failed!' ); } }); }); }); </script>
以上就是小编为大家带来的jQuery ajax中使用confirm,确认是否删除的简单实例全部内容了,希望大家多多支持脚本之家~