if(jQuery("#form_fill_hours").validationEngine('validate')){
alertify.confirm("Are you sure you want to submit this exam form to your teacher?", function (e) {
if (e) {
alertify.set({ delay: 10000 });
alertify.success("Your exam form has been submitted");
$.blockUI.defaults.message = "<h1 class='block_msg'>Please Wait...</h1>";
$.post( SITE_URL+"fill/save/saveformexam?type=1",$("#form_fill_hours").serialize(), function( data ) {
window.location.href="<?php echo EXAM_URL."exam/weekly/index?week=".$_GET['week'] ?>";
});
} else {
alertify.error("Your exam form is not submitted");
}
});
return false;
}else{
return false;
}使用alertify,我已经为成功消息设置了10 secs延迟,但它不起作用?我只需要向用户显示成功警报,然后重定向到同一个页面。
尝试过使用delay,但不起作用:
alertify.success("Your exam form has been submitted");//show alert to user
delay(100);//wait for 10 secs and then post form data
$.post( SITE_URL+"fill/save/saveformexam?type=1",$("#form_fill_hours").serialize(), function( data ) {
window.location.href="<?php echo EXAM_URL."exam/weekly/index?week=".$_GET['week'] ?>";
});我如何在成功消息中设置一些延迟,以便用户能够看到它,然后将表单详细信息发布到控制器操作中?
发布于 2015-07-09 11:22:12
.delay()只在jQuery效果之间使用。这是医生们说的
.delay()方法是在排队的jQuery效果之间延迟的最佳方法。因为它是有限的--例如,它没有提供一种取消延迟的方法--.delay()不能替代JavaScript的本机setTimeout函数,这可能更适合于某些用例。
因此,在post方法之前创建延迟的唯一方法是设置超时。
setTimeout(function(){
$.post( SITE_URL+"fill/save/saveformexam?type=1",$("#form_fill_hours").serialize(), function( data ) {
window.location.href="<?php echo EXAM_URL."exam/weekly/index?week=".$_GET['week'] ?>";
});
}, 1000);https://stackoverflow.com/questions/31315216
复制相似问题