In my dialog have two buttons. If I click on the close button the dialog box closes and page reloaded. How to close dialog without page reloading? My code:
add_bankday.dialog({
autoOpen: false,
width: 400,
buttons: [{
id: 'submit',
text: <?php echo json_encode('Add'); ?>,
click: function(event){
if ($('#password').val() != calendar.resource.password){
$('#error').text(<?php echo json_encode('Wrong password'); ?>).css('visibility', 'visible');
return;
}
$.ajax({
type: 'POST',
url: 'ajax.php',
async: false,
data: {
op: 'add_bankday',
day: $('#new_bank_day').val(),
password: $('#ab_password').val()
},
success: function(res){
}
});
}
},
{
id: 'bank_close',
text: <?php echo json_encode('Close'); ?>,
click: function(){
$('#new_bank_day').val('');
$('#add_bankday').dialog('close');
}
}]
});
只是一个想法:由于看起来您正在使用 ajax 请求,请确保您已禁用任何正常的 html 表单提交控件并使用纯 html 按钮!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.