title: Assign ajax Response Values to PHP Variables
body: <p>I'm calling ajax from <code>AddSomething.php</code> file as follows </p>
  
  <pre><code>&lt;script&gt; 
      var dataValue; 
      $("#schedule").change(function () { 
          var value = $('#schedule option:selected').text(); 
          var ajaxCheck = $.ajax({ 
              url: 'processClg.php', 
              type: 'POST', 
              dataType: 'json', // processClg.php will return string means change to text 
              data: { id: value }, 
              success: function(data){ 
                  dataValue = data; 
                  console.log(dataValue); 
              } 
          }); 
      }); 
  &lt;/script&gt;
  </code></pre>
  
  <p>Getting response in Network as follows </p>
  
  <pre><code>[{
      "id": "2",
      "scheduleName": "abc",
      "subject": "Patho",
      "university": "xyz",
      "facultyName": "Dr",
      "scheduleStartDate": "2015-06-05",
      "scheduleEndDate": "2015-06-09"
  }]
  </code></pre>
  
  <p>And in console it is showing <code>[Object]</code></p>
  
  <p>How can I assign the above values to the following PHP variables present in the same page </p>
  
  <pre><code>&lt;?php
      $scheduleStartDate ='';//Here How can i assign respected ajax responsevalue
      $scheduleEndDate = '';//Here How can i assign respected ajax response value
  
      $qry = "SELECT * FROM `mytable`
          WHERE `university` LIKE ''//Here How can i assign value  
          ORDER BY `university` DESC,student_name ASC";
  ?&gt;
  </code></pre>
  
  <p>processClg.php file code</p>
  
  <pre><code>&lt;?php
      include "config.php";
      $qry = "SELECT * FROM `schedule` WHERE scheduleName LIKE '".$_POST['id']."'";
      $res = mysqli_query($link, $qry);
      //echo $res;
  
      while($row = mysqli_fetch_assoc($res))
          $test[] = $row; 
  
      echo json_encode($test);
  ?&gt;
  </code></pre>