Skip to content

Instantly share code, notes, and snippets.

@jtay
Created September 26, 2018 10:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtay/15480b32ef1c3220f5346a16e5773593 to your computer and use it in GitHub Desktop.
Save jtay/15480b32ef1c3220f5346a16e5773593 to your computer and use it in GitHub Desktop.
Validating Student Discount
$(document).ready(function(){
$("button.btn").click(function(){
var NUS_Card_Number = $("#NUS_Card_Number").val();
var systemIntegratorId = '9000049';//Math.floor((Math.random() * 100000000) + 1);
if(NUS_Card_Number == "")
{
alert("NUS Card Number is required.");
return false;
}
else{
//alert('hello');
// var get_eight_char = NUS_Card_Number.substr(0, 8);
var check_number = NUS_Card_Number.startsWith("98261360");
if(check_number != false)
{
//$('#demo').html('<p>Valid Card Number.</p>');
window.location.href="/collections/student-discount";
}
else{
$('#demo').html('<p style="color:red;">Invalid Card Number.</p>');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment