在我的项目中,我有 jquery 警报框。单击该警报框按钮我的页面将刷新,这可能吗?请帮助我。单击“确定”按钮后,我的页面将刷新。
successMsg: function(msg){
$.alert("hii");
$.alert({
title: 'Message:',
type: 'green',
columnClass: 'col-md-6 col-md-offset-3',
content: msg,
buttons: {
Okay: {
btnClass: 'btn-success',
}
}
最佳答案
假设您正在使用the jquery-confirm.js library ,您应该将回调函数作为 onClose
属性传递,并调用其中的 location.reload()
函数:
$.alert({
title: 'Test',
content: 'Click "ok" to reload.',
onClose: () => location.reload(),
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://wzrd.in/standalone/jquery-confirm@latest"></script>
关于javascript - 可以在 jquery 中单击警报框按钮时编写页面刷新代码吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48747625/