Jump to content

not sure what's wrong


justinh

Recommended Posts

 
<script language="javascript" type="text/javascript">

var request = false;

try {
request = new XMLHttpRequest;

} catch (trymicrosoft) {

try {

request = new activeXObject("Msxml2.XMLHTTP");

} catch (tryothermicrosoft) {

try {

request = new activeXObject("Microsoft.XMLHTTP");

} catch (failed) {
request = false;
}
}
}
if(!request){

  alert("Error intializing XMLHTTP");
  
  }
  
  function addProduct(){
  var item = document.getElementById("item").value;
  var url = "inc.additem.php?item=" + item;
  request.open("GET", url, true);
  request.onreadystatechange = updatePage;
  request.send(null);
  
  }
  
  function updatePage(){
  if(request.readystate == 4){
  document.getElementById("items")innerHTML = request.responseText;
  }
}
  

 

errors reported back:

 

 missing ; before statement
[break on this error] document.getElementById("items")innerHTML = request.responseText;\n

addProduct is not defined
[break on this error] addProduct();

 

I've just started learning AJAX so I'm not the best, but I don't understand how these errors are coming up.

 

Any help would be awesome!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.