Answer the question
In order to leave comments, you need to log in
Is there an analogue of include through java-script (you need a local insertion of one piece of html into another)?
I'm laying out large pages, it would be convenient to divide them into pieces and call smaller pieces in the main html using js, is this possible?
(The suggestion to run a local php project does not work)
Answer the question
In order to leave comments, you need to log in
api.jquery.com/jQuery.get - there, even in the examples, the code for loading html and inserting it into a block.
If the server is under Apache, then SSI will help: httpd.apache.org/docs/current/howto/ssi.html
What would work without a server is better to do something like this:
You just need to modify it with a file.
In the days before Ajax, this is how Ajax support was implemented in older browsers, and in the same way, sending files still works in most modern browsers.
Well, just execute an Ajax request to the desired piece, and then insert it into the page?
But all this will slow down the page loading a little, if not critical, then any js framework will do this with two lines of code.
the trick is that without a server and as simple as possible, the solution has already been found (see above)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question