W
windandwaves
Hi Folk
Consider the following function:
function UpdateHtml(url, parameters, onready) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
// set type accordingly to anticipated content type
http_request.overrideMimeType('text/xml');
//http_request.overrideMimeType('text/html');
}
}
else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
alert('could not load data');
}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
//var onreadyfunction = new function() { eval(onready);}
http_request.onreadystatechange = updatemap;
var geturl = url + '?' + parameters;
document.getElementById(idname + 'title').innerHTML = "loading new map
.... " + geturl;
http_request.open('GET', geturl, true);
http_request.async = false;
http_request.send(null);
}
It opens xml and assigns a function that should run when it is loaded.
In the form above, it works, however, I want it to work with the
variable that I pass. When I rewrite the JS below from:
//var onreadyfunction = new function() { eval(onready);}
http_request.onreadystatechange = updatemap;
to
var onreadyfunction = new function() { eval(onready);}
http_request.onreadystatechange = onreadyfunction;
it does not work
what am I doing wrong?
Thanks heaps in advance
Nicolaas
Consider the following function:
function UpdateHtml(url, parameters, onready) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
// set type accordingly to anticipated content type
http_request.overrideMimeType('text/xml');
//http_request.overrideMimeType('text/html');
}
}
else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
alert('could not load data');
}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
//var onreadyfunction = new function() { eval(onready);}
http_request.onreadystatechange = updatemap;
var geturl = url + '?' + parameters;
document.getElementById(idname + 'title').innerHTML = "loading new map
.... " + geturl;
http_request.open('GET', geturl, true);
http_request.async = false;
http_request.send(null);
}
It opens xml and assigns a function that should run when it is loaded.
In the form above, it works, however, I want it to work with the
variable that I pass. When I rewrite the JS below from:
//var onreadyfunction = new function() { eval(onready);}
http_request.onreadystatechange = updatemap;
to
var onreadyfunction = new function() { eval(onready);}
http_request.onreadystatechange = onreadyfunction;
it does not work
what am I doing wrong?
Thanks heaps in advance
Nicolaas