开发者

window.close() in success function

开发者 https://www.devze.com 2023-02-14 10:14 出处:网络
I have a typical ajax post type with a success function. I have tried in many different ways to close window on success.

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消