title: Assign $.ajax to variable
body: <p>I'm not getting any output the id_function.php works perfectly fine can anyone please help me? </p>
  
  <p>JavaScript</p>
  
  <pre><code> function get_details()
      {
          var oriz = document.getElementById("from").value;
          var dizz = document.getElementById("to").value;
  
          var id_orig_diz = $.ajax({
              type: "POST", 
              url: 'id_function.php?orig='+oriz+'&amp;des_id='+dizz,
              dataType: "text", 
              async: false
                          }).responseText;
          alert(id_orig_diz); 
  
      }
  </code></pre>
  
  <p>This is my PHP but I'm not getting any id</p>
  
  <pre><code>            &lt;?php
              $name_1 = $_GET['orig'];
              $name_2 = $_GET['des_id'];
              try {
                  $dbuser = "kim";
                  $dbpass = "kim";
                  $conn = new PDO('mysql:host=localhost;dbname=destination', $dbuser, $dbpass);
                  $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);    
                  $stmt = $conn-&gt;prepare("SELECT pl_id FROM view_places WHERE name = :name LIMIT 1");
  
                  $stmt-&gt;bindParam(':name',$name_1); 
                  $stmt-&gt;execute();
                  $result_1 = $stmt -&gt; fetch();
                  $res1 = $result_1["pl_id"];  
  
                  $stmt-&gt;bindParam(':name', $name_2); 
                  $stmt-&gt;execute(); 
                  $result_2 = $stmt -&gt; fetch(); 
                      $res2 = $result_2["pl_id"];  
                      echo   'origin_number:'.$res1. ', '.'destination_id:'.$res2;
                  }   catch(PDOException $e) {
                          echo 'ERROR: ' . $e-&gt;getMessage();
                  }
  
              ?&gt;
  </code></pre>