Hi guys, so i posted a thread here a couple of days ago about getting the id of a link that was clicked to a javascript function. that was answered in minutes. great
but i have another question or problem.
i have this img
and this links to the typical ajax script that checks the browser and then sends the query.HTML Code:<a href="#" onClick="ajaxFunction(this.id)" id="volcano"><img src="images/lines.jpg" /></a>
so when i get to the ajax.php and try to print out the results of an sql query it doesnt seem to do so. I mean when i click on the link in my page it empties the ajaxDiv (cos i have something in there already, which i want to replace) but doesnt put anything in it. i cant even seem to get an echo to come out that is at the top of the ajax.php script....Code:function ajaxFunction(id) { var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { var ajaxDisplay = document.getElementById('ajaxDiv'); ajaxDisplay.innerHTML = xmlHttp.responseText; } } var queryString = "?type=" + id; xmlHttp.open("GET", "ajax.php" + queryString, true); xmlHttp.send(null); } </script>
any help please?





Reply With Quote


Bookmarks