title: Verify mobile number
body: <p>can anyone help on how to verify mobile numbers in this script using Ghana number formats. The script validates with only Indian mobile numbers. I want to use ghana mobile numbers to validate the code. </p>
  
  <p>Ghana mobile numbers start with 02 or 05. Thank u.</p>
  
  <pre><code>     pic1 = new Image(16, 16); 
  pic1.src = "images/loader.gif";
  
  /*function mobile_validation(mobile_number)
  {
      var first_digit = mobile_number.charAt(0);
      var number_length = mobile_number.length;
      if(!isValid(mobile_number, 'numeric'))
          return "Please enter valid mobile number.";
      if(mobile_number.indexOf("+91") != -1 || mobile_number.indexOf("0") == 0 || number_length != 10) //ghana country code is +233
          return "Please enter valid mobile number.";
      if(first_digit != 9 &amp;&amp; first_digit != 8 &amp;&amp; first_digit != 7) //want to change to 02 or 05
          return "Please enter a valid mobile number.";
      if(mobile_number == "9867045061")
          return "Please enter a valid mobile number.";
      return "valid";
  }*/
  
  $(document).ready(function(){
  
  $("#mobile").change(function() { 
  
  var usr = $("#mobile").val();
  var first_digit = usr.charAt(0);
  var number_length = usr.length;
  
  if(usr.length == 10 &amp;&amp; !isNaN(usr) &amp;&amp; first_digit == 9 || first_digit == 8 || first_digit == 7) // want to change to 02 or 05
  {
  $("#statusmb").html('&lt;img src="images/loader.gif" align="absmiddle"&gt;&amp;nbsp;Sending Verification Code...');
  
      $.ajax({  
      type: "POST",  
      url: "verify_mobile.php",  
      data: "mobile="+ usr,  
      success: function(msg){  
  
     $("#statusmb").ajaxComplete(function(event, request, settings){ 
  
      if(msg == 'OK')
      { 
          $("#mobile").removeClass('object_error'); // if necessary
          $("#mobile").addClass("object_ok");
          $(this).html('&amp;nbsp;&lt;img src="images/ok.png" align="absmiddle"&gt;&amp;nbsp;Verification Code Sent to Mobile');
          document.getElementById('btnSubmit').disabled =false;
      }  
      else  
      {  
          $("#mobile").removeClass('object_ok'); // if necessary
          $("#mobile").addClass("object_error");
          $(this).html(msg);
          document.getElementById('btnSubmit').disabled =true;
      }  
  
     });
  
   } 
  
    }); 
  
  }
  else
      {
      $("#statusmb").html('&amp;nbsp;&lt;img src="images/alert.png" align="absmiddle"&gt;&amp;nbsp;&lt;font color="red"&gt;Please Enter &lt;strong&gt;Valid&lt;/strong&gt; Mobile No.&lt;/font&gt;');
      $("#mobile").removeClass('object_ok'); // if necessary
      $("#mobile").addClass("object_error");
      }
  
  });
  
  });
  </code></pre>