justinh Posted January 21, 2009 Share Posted January 21, 2009 <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! Quote Link to comment Share on other sites More sharing options...
justinh Posted January 21, 2009 Author Share Posted January 21, 2009 nvm problem solved. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.