title: How to query database using javascript?
body: <p>Another question by a newbie. I have a php variable that queries the database for a value. It is stored in the variable $publish and its value will change (in the database) when a user clicks on a hyperlink.</p>
  
  <pre><code>if ($publish == '') { 
  Link to publish.html
  } else { 
  Link to edit.html
  } 
  </code></pre>
  
  <p>What is happening in the background is i am querying a database table for some data that i stored in the $publish variable. If the $publish is empty, it will add a link for publish.html in a popup. The popup will process a form and will add the data to the database and which means that the $publish is no more empty. What i would like to achieve is that as soon as the form is processed in the popup and a data has been added to the database, the link should change to edit.html. This can happen when the page will re-query the database but it should happen without page refresh.</p>
  
  <p>How can it be donw using javascript, jquery or ajax?? Please assist.</p>