function ajaxFunction(id){
var ajaxRequest;
var response;
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
alert("Ajax Failed");
return false;
}
}
}
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
response = ajaxRequest.responseText;
}
}
ajaxRequest.open("GET", "http://priest/getpic.php?id="+id, true);
ajaxRequest.send(null);
return response;
}
function lightbox(id) {
var image;
var imageArr;
document.write(image);
image = ajaxFunction(id);
imageArr = image.split('|');
imageSrc = imageArr[0];
imageWidth = imageArr[1];
imageHeight = imageArr[2];
getElementById('lightbox').visibility=visible;
getElementById('lightboximg').src=imageSrc;
if(imageWidth > 700) {getElementById('lightboximg').width=700;}
if(imageHeight > 500) {getElemetnById('lightboximg').height=500;}
}
The problem I'm having is where my code calls the ajaxFunction() into the image variable the ajaxFunction() isn't returning anything into the variable, causing me to get the following error.
Uncaught TypeError: Cannot call method 'split' of undefined lightbox (anonymous function)
Any Help would be greatly Appreciated.