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! Link to comment https://forums.phpfreaks.com/topic/141825-not-sure-whats-wrong/ Share on other sites More sharing options...
justinh Posted January 21, 2009 Author Share Posted January 21, 2009 nvm problem solved. Link to comment https://forums.phpfreaks.com/topic/141825-not-sure-whats-wrong/#findComment-742553 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.