I've a HTML which loads several Javascript files:
<script src="assets/js/a.js"></script> <script src="assets/js/b.js"></script> <script src="assets/js/jquery.min.js"></script>
As I debug/test my Javascripts in my browser's console, is it possible to reload these Javascript files without the need to reload the entire HTML page?
AJAX = Asynchronous JavaScript and XML. AJAX is a technique for creating fast and dynamic web pages. AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.
You can use the location. reload() JavaScript method to reload the current URL. This method functions similarly to the browser's Refresh button. The reload() method is the main method responsible for page reloading.
In JavaScript, you refresh the page using document. location. reload() . You can add the true keyword to force the reloaded page to come from the server (instead of cache).
Use this. $('#mydiv'). load(document. URL + ' #mydiv');
You could remove and then re-add them:
$('script').each(function() { if ($(this).attr('src') !== 'assets/js/jquery.min.js') { var old_src = $(this).attr('src'); $(this).attr('src', ''); setTimeout(function(){ $(this).attr('src', old_src + '?'+new Date()); }, 250); } });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With