embed a div from another page

The way with less code is a jquery script. Like the following:

<p id="new"></p>

<script>
$( "#new" ).load( "/your-path/your-file.php #your-div" );
</script>

The only security limit is that you cannot use an absolute path, beginning with https:// .

But you can use a php variable to set your javascript value so that it may be available from any folder (sub-folder) of your website. See here how to pass a php variable to javascript.

Lascia un commento

Il tuo indirizzo email non sarà pubblicato.