javascript - JS - location reload with delay after function executed - Stack Overflow

I am running a JSAJAX script to update data in my table and once the script is done, I would like to

I am running a JS / AJAX script to update data in my table and once the script is done, I would like to reload the page. However, with my current code, it reloads immediately, is there any way to delay the reload for 3 secs?

// close modal and refresh page
$('#EditRecordModal').modal('hide');
location.reload();

Thanks

I am running a JS / AJAX script to update data in my table and once the script is done, I would like to reload the page. However, with my current code, it reloads immediately, is there any way to delay the reload for 3 secs?

// close modal and refresh page
$('#EditRecordModal').modal('hide');
location.reload();

Thanks

Share Improve this question asked Sep 22, 2016 at 12:20 Armitage2kArmitage2k 1,2742 gold badges33 silver badges66 bronze badges 2
  • 2 Possible duplicate of How to delay execution in between the following in my javascript – Joe Clay Commented Sep 22, 2016 at 12:21
  • Do you get a response from your database/server? You can wait until the response es and then reload the page/display error message if not updated in database. – Dinca Adrian Commented Sep 22, 2016 at 12:28
Add a ment  | 

1 Answer 1

Reset to default 5
$('#EditRecordModal').modal('hide');
setTimeout(function(){location.reload()}, 3000);

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742410317a4438680.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信