title: How to set the ajax success result value to PHP variable in same page
body: <pre><code> function submitID(){
  
   // some codes working in here....
  
  var text="A_1";                 
  var name="test";
  
  $.ajax({
      url: 'callmethod.php',
      type: 'post',
      data: {'action':'methodname', 'text': text, 'name':name},
              success: function(data, status) {
              var results = JSON.parse(data);
  
              for(var i = 0; i &lt; results.length; i++){
                  var id= results[i]['ID'];
                  alert(id);  --- I got the value of ID in here -- example output value : Hello                                                                       
              }
          },
          error: function(xhr, desc, err) {
              console.log(xhr);
              console.log("Details: " + desc + "\nError:" + err);
          }
      });
  }
  </code></pre>
  
  <p>What I would like to do in here, I got the value of var id but I want to set as the PHP variable $valuephp= >>> <strong>id</strong> &lt;&lt;&lt; how can I do for that? please help me to advice.</p>