title: Issues with the response from the server
body: <p>I implemented a calculator with AJAX, PHP and JavaScript. Calculation is done in the PHP code. When I send the server the request for the response, I am getting the whole source code of the PHP file. How can I prevent this?</p>
  
  <p>This is my JavaScript code:</p>
  
  <pre><code> var xmlHTTP;
      var operation;
  
      function process() {
  
  
          var number1 = document.getElementById("n1").value;
  
          var num1 = parseInt(number1);
  
          var number2 = document.getElementById("n2").value;
          var num2 = parseInt(number2);
  
  
          var answer;
          if (document.getElementById('+').checked) {
              operation='add';
          } else if (document.getElementById('-').checked) {
              operation='subs';
          }
          else if (document.getElementById('*').checked) {
              operation='mul';
          }
          else if (document.getElementById('/').checked) {
              operation='div';
          }
  
      }
      function loadDoc() {
          process();
          xmlHTTP=new XMLHttpRequest();
          xmlHTTP.onreadystatechange = function () {
              alert(xmlHTTP.readyState);
              alert(xmlHTTP.status);
              if (xmlHTTP.readyState == XMLHttpRequest.DONE) {
  
                  document.getElementById("cal").i=xmlHTTP.responseText;
              }
          }
          xmlHTTP.open("POST","process.php?value1=num1&amp;value2=num2&amp;value3=operation", true);
          xmlHTTP.send();
  
      }
  
  
    &lt;?php
  
  $number1 = $_POST['value1'];
  $number2=$_POST['value2'];
  $answer=0;
  $op=$_POST['operation'];
  
  //echo $answer;
  if($op="add"){
      $answer=$number1+$number2;
  }
  elseif($op="subs"){
      $answer=$number1-$number2;
  }
  elseif($op="mul"){
      $answer=$number1*$number2;
  }
  elseif($op="div"){
      $answer=$number1/$number2;
  }
  else{
      echo "Choose an operation";
  }
  echo $answer;
  </code></pre>