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
1 Answer
Reset to default 5$('#EditRecordModal').modal('hide');
setTimeout(function(){location.reload()}, 3000);
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742410317a4438680.html
评论列表(0条)