Hi stackoverflow people,
I'm making a variable code where you can easily put another file-code in between e.g. a div
. I'm wondering if you can include a PHP-file via JavaScript, with JS variables. I can do it via PHP but can I include a file with JS?
HTML:
<div id="someId">THE INCLUDE HERE</div>
JS:
var tag_id = 'someId'; //comes form DB
var url = 'data/includes/code.php'; // comes from DB
$('#' + tag_id).html('<?php include("' + url + '"); ?>');
As you can see, tag_id
is the id of a object and the url is not static but comes from the DB.
I've read and tried those (but didn't work..):
Maybe I have to think out of my box, can you guys help me?
(Sorry for bad English...)