MikeDXUNL Posted January 21, 2008 Share Posted January 21, 2008 When a user click "Owned" it should move it to their owned List.... thats not the case though... actions.js var xmlHttp function newadd(str2, str3, str4) { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="ajax/whattodo.php"; url=url+"?gameid="+str2"&whereto="+str3"&type_q="+str4; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("txtHint7").innerHTML=xmlHttp.responseText; } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } myfile.php <div id="txtHint7"></div> <a href="#" onClick="newadd('<?php echo $gameid; ?>', 'Owned', 'videogames')">Owned</a> whattodo.php $gameid = (!isset($_GET['gameid']) || !is_numeric($_GET['gameid'])) ? "0" : $_GET['gameid']; echo $gameid."<br />"; echo $_GET['whereto']."<br />"; echo $_GET['type_q']."<br />"; however nothing happens, any help is appreciated btw, I am new to JS and AJAX Thanks, Mike Quote Link to comment Share on other sites More sharing options...
fanfavorite Posted January 23, 2008 Share Posted January 23, 2008 Doesn't look like there is anything wrong with your code. Watch out for paths, make sure that var url="ajax/whattodo.php"; is the correct path to the whattodo.php file. The best thing for debugging Ajax is to download Firefox, if you don't already have it and download the Firebug plugin. This shows you the calls and what is updated on the page. 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.