{"id":2592,"date":"2022-04-18T18:17:29","date_gmt":"2022-04-18T16:17:29","guid":{"rendered":"https:\/\/digitalia.culturanuova.net\/blog\/?p=2592"},"modified":"2022-05-06T16:01:17","modified_gmt":"2022-05-06T14:01:17","slug":"embed-a-div-from-another-page","status":"publish","type":"post","link":"https:\/\/digitalia.culturanuova.net\/blog\/?p=2592","title":{"rendered":"embed a div from another page"},"content":{"rendered":"\n<p>The way with less code is a jquery script. Like the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;p id=\"new\"&gt;&lt;\/p&gt;\n\n&lt;script&gt;\n$( \"#new\" ).load( \"\/your-path\/your-file.php #your-div\" );\n&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<p>The only security limit is that you cannot use  an absolute path, beginning with <code>https:\/\/<\/code> .<\/p>\n\n\n\n<p>But you can use a php variable to set your javascript value so that it may be available from <em>any<\/em> folder (sub-folder) of your website. See here how to <a href=\"https:\/\/localhost\/web\/public_html\/digitalia\/wordpress\/?p=2598\">pass a php variable to javascript<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The way with less code is a jquery script. Like the following: 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 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/digitalia.culturanuova.net\/blog\/?p=2592\" class=\"more-link\">Leggi tutto<span class=\"screen-reader-text\"> &#8220;embed a div from another page&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[747,1,566],"tags":[749,748,230],"class_list":["post-2592","post","type-post","status-publish","format-standard","hentry","category-javascript","category-senza-categoria","category-webmaster","tag-div","tag-embed","tag-jquery"],"_links":{"self":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2592","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2592"}],"version-history":[{"count":3,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2592\/revisions"}],"predecessor-version":[{"id":2600,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2592\/revisions\/2600"}],"wp:attachment":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}