Making dynamic SQL queries from Javascript
Impossible? No! Just add some AJAX to your <head> section: <script type=”text/javascript”> function request(query){ if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();} else{xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);} if (xmlhttp.readyState==4 && xmlhttp.status==200){ //it worked. alert(xmlhttp.responseText); //this is the output of your query.php file }else{ //whatever happens when it doesn’t work alert(‘Query did not work.’); } xmlhttp.open(“GET”,”query.php?q=”+query,true); xmlhttp.send(); } </script> and create the new page [...]