objective
I need a function that simply takes all the code from another file and pastes the code in the calling file.
possible solution
a function that works like the include()
function in PHP.
reason
When I had hosting, I used the php function include("filename.html")
to include things like headers and footers, in all the files on the website. This made life a lot easier!
Now I don't have hosting, because I am working on another site, and I am using Github Pages and thus, I can't use PHP. I need to use only HTML, JS and jQuery etc. So, I need a function that simply takes all the code from another file and pastes the code in the calling file.
Already tried
load()
in jQuery.<pre><script> $(document).ready(function(){ $("#topbar").load("menubar.html"); }); </script></pre>
This question. I tried the accepted answer, but that didn't work for me.
Kindly help me with this issue.