Refresh on json file update

$( document ).ready(function() { (function poll() { setTimeout(function() { $.ajax({ url: "../data.json", type: "GET", success: function(data) { location.reload(); }, dataType: "json", complete: poll, timeout: 5000 }) }, 3000); })(); });
Checks external JSON file for changes and if changes are found they will refresh the page.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.