title: sum two numbers using php and ajax
body: <p>Here is my html code:</p>
  
  <pre><code>   &lt;form name="sumForm" action=""&gt;
  &lt;input type="text" id="num1" name="num1" /&gt;
  
  &lt;input type="text" id="num2" name="num2" /&gt;
  
  &lt;input type="submit" id="sum"  value="sum"/&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  
  
  <p>here is my jquery code:</p>
  
  <pre><code>       $("#sum").click(function() {
                          var num1 = $("#num1").val();
                          var num2 = $("#num2").val();
  
  
                          var dataString = "num1="+ num1 + "&amp;num2=" + num2; 
  
                          $.ajax({
                          type: "POST",
                          url: "apotelesma.php",
                          data: dataString,
                          success: function() {
                             alert(dataString)
  
                                  return false;
                          }
                  });
                  return false;
          });
  </code></pre>
  
  <p>and here is apotelesma.php script:</p>
  
  <pre><code>&lt;?php
  
  $num1 = isset($_POST['num1']);
  $num2 = isset($_POST['num2']);
  
  $apotelesma = 0;
  
  $apotelesma = $num1 + $num2;
  
  echo $apotelesma;
  
  ?&gt;
  </code></pre>
  
  <p>I can't figure out how to get the result. I don't know if is correct to include php script to display result.</p>