help me please to figure out what I’m missing.
That’s my html named “test.html”
<div id="div-test">
lalalalaal
<ul>
<li>Hi</li>
<li>By</li>
</ul>
</div>
And that’s another html file in the same directory, that contains this:
<div id="result"></div>
<script type="text/javascript">
$(function() {
$("#result").load("test.html");
});
</script>
But it doesn’t load anything.
however, this works fine:
<div id="result"></div>
<script type="text/javascript">
$(function() {
$("#result").html("i see this text");
});
</script>
When i need to load data regularly i just create a function to load dynamically so i can either call it when i need, or when the page is done loading
As noted below, this will not execute locally unless you’re running a WAMP server. Also the paths to the files you are loading may need to be relative if they are not residing in the same directory as the page with this code.