reload

How can I refresh a page with jQuery?

◇◆丶佛笑我妖孽 提交于 2019-11-26 01:23:19
问题 How can I refresh a page with jQuery? 回答1: Use location.reload(): $('#something').click(function() { location.reload(); }); The reload() function takes an optional parameter that can be set to true to force a reload from the server rather than the cache. The parameter defaults to false , so by default the page may reload from the browser's cache. 回答2: This should work on all browsers even without jQuery: location.reload(); 回答3: There are multiple unlimited ways to refresh a page with

Prevent Page Load on Jquery Form Submit with None Display Button

三世轮回 提交于 2019-11-26 01:09:48
问题 I have a chatbot of sorts set in MSDOS terminal style. The user types their response then hits enter. I have found that when I tag the button with \"display: none;\" it causes the page to reload on several browsers (my windows chrome browser doesn\'t reload. not sure why). How can I have the button hidden yet the form and code functioning properly? I would rather not use \"position: absolute;\" to send it off screen. HTML: <div id=\"bot\"><form> <input id=\"user-response\" type=\"text\"

How do I unload (reload) a module?

一曲冷凌霜 提交于 2019-11-25 23:56:36
问题 I have a long-running Python server and would like to be able to upgrade a service without restarting the server. What\'s the best way do do this? if foo.py has changed: unimport foo <-- How do I do this? import foo myfoo = foo.Foo() 回答1: You can reload a module when it has already been imported by using the reload builtin function: from importlib import reload # Python 3.4+ only. import foo while True: # Do some things. if is_changed(foo): foo = reload(foo) In Python 3, reload was moved to

How to reload a page using JavaScript

烈酒焚心 提交于 2019-11-25 22:35:02
问题 How can I reload the page using JavaScript? I need a method that works in all browsers. 回答1: JavaScript 1.0 window.location.href = window.location.pathname + window.location.search + window.location.hash; // creates a history entry JavaScript 1.1 window.location.replace(window.location.pathname + window.location.search + window.location.hash); // does not create a history entry JavaScript 1.2 window.location.reload(false); // If we needed to pull the document from // the web-server again