Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Question ajaxDisplay is null?

    Can someone please help?

    I get the following error:

    ajaxDisplay is null:

    ajaxDisplay.innerHTML = productoptionidRequest.responseText;

    here is my code

    PHP 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); 
    Code:
    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);
    			}

  • #2
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    I have now sorted this! I didn't have the <div id="ajaxDiv"></div> in place! silly me!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •