title: Onclick/Ajax on the Generate OTP without reloading?
body: <p>I am having an issue that <strong>how to send the number to next page</strong> where it handles the mobile number and send a message to the user mobile number. By Using onClick method or by using ajax method can we send the message without reloading the page like below in the code.</p>
  
  <p><strong>index.php</strong></p>
  
  <pre><code>    &lt;form method="POST" action="test.php"&gt;
      &lt;input type="text" class="form-control" name="mobile" placeholder="Mobile" maxlength="10"&gt;
  
                      &lt;input type="text" class="form-control" name="otp" placeholder="OTP" maxlength="11" style="width: 40%; float: left;"&gt;
  
                      &lt;input type="submit" id="btnonOtp" value="Generate OTP" class="form-control" style="background-color:#005995;width: 56.5%; float: left; margin: 0 0 0 12px; border-radius: 0;"&gt;
     &lt;/form&gt;
  
  $('#btnonOtp').click(function()
  {
      $.ajax({
          url: test.php,
          type:'POST',
          data:
          {
              text: mobile,
              value: mobile
          },
          success: function(msg)
          {
              alert('OTP Sent');
          }               
      });
  });
  </code></pre>
  
  <p><strong>Test.php</strong></p>
  
  <pre><code>    &lt;?php 
  include 'send.php'; 
  
  
  $_SESSION['smsotp'] = sms_OTP();
  $num=$_POST['mobile'];
  $number = $num; 
  //$text = 'Hi There, how are you?'; 
  $sms_api_result = sms_Send($number, 'Please do not share the one time password with anyone. Your One Time password is: '.$_SESSION['smsotp'],$debug);
  
  ?&gt;
  </code></pre>
  
  <p>If I run the test.php with mobile number passing directly then the message is delivered, but I need to pass the mobile number dynamically to $num variable. </p>
  
  <p>Can any one help me where I am going wrong??</p>