当数据传递时,我试图显示一条成功的消息。即使数据通过了,我也没有得到,这在chrome控制台中显示
未捕获的ReferenceError:未定义swal
成功@客户忠诚度:40
(匿名功能)@ CustomerLoyalty:217
40行:
<script>
function alerts() {
swal({ title: "Are you sure you want to delete?", text: "You will not be able to recover this record!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Delete", closeOnConfirm: false }, function(){ swal("Deleted!", "Employee Record has been deleted", "success"); });
}
function success() {
swal("Warning!","Failed to record leave!", "success")
}
</script>
上面是我的swal函数,当我在控制台中单击错误时,“ swal(“警告!”,“未能记录请假!”,“成功”)“用红色下划线标出。 (请参见屏幕截图)
第217行:
<form role="form" method="POST" action="http://localhost:8000/CustomerLoyalty">
<script type="text/javascript">success();</script>
谁能告诉我这里怎么了?我已经在标题中也粘贴了swal链接。screenshot:
最佳答案
如果swal
本身显示为undefined
,则将完全加载swal脚本dint。加载时检查您的网络标签,看看是否已加载swal js。