Sam Oldak
Recent graduate in engineering and environmental policy
  • Home
  • About
  • News/Blog
  • Portfolio
    • BuildingCTGreen
    • Carol Freedman Design
    • Connecticut Climate Change
    • Eats for a Week
    • Regulation UnFettered
    • The Resume Book
    • Wharton Politics and Business Association
  • Contact

AJAX

Making dynamic SQL queries from Javascript

By Sam on June 22, 2011

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 [...]

Posted in Blog | Tagged AJAX, don't try this unsupervised, javascript, php, sql | 3 Responses

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Copyright © 2013 Sam Oldak.

Powered by WordPress, Hybrid, and Structure.