我想从数据库中删除特定行。但是它无法正常工作,并且在我的控制台页面中显示错误。 那是我的职能问题吗? 还是点击按钮?
(索引):393未捕获的TypeError:$ .confirm不是函数 在askDelete((索引):393)
(索引):393未捕获的TypeError:$ .confirm不是函数 在askDelete((索引):393)
<a href="javascript:askDelete(<?php echo $list->id;?>);" class="btn btn-info delete_button" role="button">Delete</a>
<button onClick="askDelete(<?php echo $list->id;?>);" class="delete_action delete_button" >Delete</button>
</ul>
</td>
</tr>
<?php $i++;}?>
</tbody>
</table>
</div>
</div>
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<script type="text/javascript" language="javascript">
function askDelete(val){
$.confirm({
title: '<h4 class="confirm-title">Delete Format</h4>',
content: '<p>Do you want to delete the format?</p>',
buttons: {
confirm: {
btnClass: 'delete-btn',
keys: ['enter', 'shift'],
action: function(){
var table = $('#myTable').DataTable();
table.row($('#program_'+val)).remove().draw(false);
var site_url = "<?php echo site_url();?>";
$.ajax({
url: site_url+'/welcome/delete_sample/'+val,
type: 'post',
success: function(data){
if(data==1){
var msg_type="1";
var msg_msg="Sample deleted successfully";
set_jnotice(msg_type, msg_msg);
return false;
}
}
});
}
},
cancel: {
btnClass: 'delete-cancel',
action:function () {
} }
}
});
}
</script>
</body>
</html>