title: Call PHP Function by Ajax
body: <p>I'm new for Web sites.I have a text box in my page and what i need is when onBlur that text box, call a php method that include sql query.I found something like on the web, but still does net work it.Am i doing wrong?</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['Greet']))
     {
        echo $_POST['Greet'];
    }
  ?&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;script type="text/javascript"&gt;
  
  function sayHi()
  {
       var value = $.ajax({
          type: "POST",
           url: "page.php",
          data: "Greet="+$("#Greeting").val(),
          async: false
          }).responseText;
  }
  
  &lt;/script&gt;
  
  &lt;input type="text" name="Greeting" id="Greeting" onblur="sayHi()"&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>