надо
eval'ить скрипт.
пример из
prototypejs.
var ScriptFragment = '<script[^>]*>([\\S\\s]*?)<\/script>';
function extractScripts() {
var matchAll = new RegExp(ScriptFragment, 'img'),
matchOne = new RegExp(ScriptFragment, 'im');
return (this.match(matchAll) || []).map(function(scriptTag) {
return (scriptTag.match(matchOne) || ['', ''])[1];
});
}
function evalScripts() {
return this.extractScripts().map(function(script) { return eval(script) });
}
String.prototype.extractScripts = extractScripts;
String.prototype.evalScripts = evalScripts;
*!*
"<div>loloiiu</div>*!*<script>alert('hello from ajax!')</script>*/!*lolol<span>lkjlkj</span>lkjlkj"*!*.evalScripts()*/!*
*/!*