There\'s a div called \"Content\":
It should be filled with data from a PHP file, by AJAX, including
Here is the script that will evaluates all script tags in the text.
function evalJSFromHtml(html) {
var newElement = document.createElement('div');
newElement.innerHTML = html;
var scripts = newElement.getElementsByTagName("script");
for (var i = 0; i < scripts.length; ++i) {
var script = scripts[i];
eval(script.innerHTML);
}
}
Just call this function after you receive your HTML from server. Be warned: using eval
can be dangerous.
Demo: http://plnkr.co/edit/LA7OPkRfAtgOhwcAnLrl?p=preview