I have a typical ajax post type with a success function. I have tried in many different ways to close window on success. But only after message is revealed and can be read.
$.ajax({
type:"POST",
url:"file.php",
data:info,
success:function(){
$('#load').empty();
$('#information').html('Thank you!');
\\setTimeout('window.close()',2000); \\
}
});
return false;
Page is opened开发者_高级运维 with "window.open()"
try
setTimeout(function(){window.close();},2000);
you can also get reference to window:
var wind = window.open();//then
setTimeout(function(){wind.close();},2000);
精彩评论