...

View Full Version : ajaxDisplay is null?



jarv
03-21-2011, 01:39 PM
Can someone please help?

I get the following error:

ajaxDisplay is null:

ajaxDisplay.innerHTML = productoptionidRequest.responseText;

here is my code



if (!isset($_GET['ProductOptionID'])){
$ProductOptionID = 1;
} else {
$ProductOptionID = $_GET['ProductOptionID'];
}

$query4 = mysql_query("SELECT * FROM ProductOptions WHERE ProductOptionID = '$ProductOptionID'");
$row2 = mysql_fetch_array($query4);




function optionsFunction(){
var productoptionidRequest; // The variable that makes Ajax possible!

try{
// Opera 8.0+, Firefox, Safari
productoptionidRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
productoptionidRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
productoptionidRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
productoptionidRequest.onreadystatechange = function(){
if(productoptionidRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = productoptionidRequest.responseText;
}
}
var ProductOptionID = document.getElementById('ProductOptionID').value;
//var queryString = "?name=" + name + "&ProductOptionID=" + ProductOptionID + "&ProductOption=" + ProductOption;
var queryString = "?ProductOptionID=" + ProductOptionID;
//Add the following line
productoptionidRequest.open("GET", "http://www.dine-with-me.co.uk/admin/add-order.php" + queryString, true);
productoptionidRequest.send(null);
}

jarv
03-21-2011, 02:10 PM
I have now sorted this! I didn't have the <div id="ajaxDiv"></div> in place! silly me!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum