I'm a bit green with this Ajax stuff, but am having a real fit trying to execute scripts in Ajax output. I've read a lot about eval and a number of other methods, but can't seem to get a working example. Below is the code I'm trying. The segment in bold is what I don't understand. I know what it is trying to do, but am not good with javascript, for instance I don't see where the function call should go. Sorry if this is a mess, I don't seek help often so don't know the typical protocol. A million thanks for any feedback!!

function createRequestObject() {
var req;
// Firefox, Safari, Opera...
req = new XMLHttpRequest();
} else if(window.ActiveXObject) {
// Internet Explorer 5+
req = new ActiveXObject("Microsoft.XMLHTTP");
} else {
// There is an error creating the object,
// just as an old browser is being used.
alert('Problem creating the XMLHttpRequest object');
return req;

// Make the XMLHttpRequest object
var http = createRequestObject();

function sendRequest(type, location, target, conf, var1, var2, var3) {
targetLocation = target;
var time= new Date().getTime();

if(location == 'admingeneral'){
http.open('get', 'admin_general.php?type='+type+'&conf='+conf+'&target='+target+'&time='+time+'&var1='+var1 +'&var2='+var2+'&var3='+var3); }

http.onreadystatechange = handleResponse;

function handleResponse() {

if(http.readyState == 4 && http.status == 200){

// Text returned FROM the PHP script
var response = http.responseText;

if(response) {
// UPDATE ajaxTest content
document.getElementById(targetLocation).innerHTML = response;



function launchJavascript(responseText) {
// RegExp from prototype.sonio.net
var ScriptFragment = '(?:<script.*?>)((\n|.)*?)(?:</script>)';

var match = new RegExp(ScriptFragment, 'img');
var scripts = responseText.match(match);

if(scripts) {
var js = '';
for(var s = 0; s < scripts.length; s++) {
var match = new RegExp(ScriptFragment, 'im');
js += scripts[s].match(match)[1];