I'm making a button that refreshes a specific div, the div is located in the index.phtml.
$('#jumbotron-table').load(document.URL);
Is not working, nothing happens.
I'm making a button that refreshes a specific div, the div is located in the index.phtml.
$('#jumbotron-table').load(document.URL);
Is not working, nothing happens.
Firstly, it would help if you specify exactly what "not working" means. Does anything happen on-screen?, is there an error message in the Javascript console?, if you enter the fuction in immediate mode into the debugger does it work then?, what if you use a fixed URL rather than a variable?
document.URL is the URL of the currently loaded page, so you're loading a copy of the current page into a div within that page. Sounds a bit odd but I can't say that it sounds impossible.
Try something like this-
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<html>
<table id="myTable"><tr><td>Content</td></tr></table>
</html>
<script>
var contentURL= "Stackoverflow_01.html";
$().ready(function() {
$('#myTable tr td').load(contentURL);
});
</script>
This loads the content of the target file into a table cell in the starting file.