title: PHP - Get random number by clicking button
body: <p>i got two php pages, one generating random numbers and another displaying on refresh page. </p>
  
  <p>i want to get current random value by clicking not refreshing.</p>
  
  <p>we could use javascript / ajax / jquery for that please help me any best way</p>
  
  <p>1.php</p>
  
  <pre><code>&lt;?php
   include("2.php");
  
   $getnumber=$_SESSION['randomnumber'];
  
   ?&gt;
  
   &lt;button class="button" type="button" name="buttonpassvalue" &gt;Get Random Number&lt;/button&gt; 
  </code></pre>
  
  <p>2.php</p>
  
  <pre><code> &lt;?php
    $rannumber=rand();
  
     $_SESSION['randomnumber']=$rannumber;
     ?&gt;
  </code></pre>
  
  <p>thanks for your help.</p>