Get information about a credit card number. Provided a credit card, (including partial numbers), the function returns information about your card, for example:
cardInfo("5105105105105100");Returns an object with the following properties:
{
"cardType":"CA", // Type code of the card
"cardName":"MasterCard", // Name of the card
"lengths":"16", // Valid lengths for this card type
"prefixes":"51,52,53,54,55", // Valid prefixes for this card type
"checkdigit":true, // True if a checkdigit is used to validate this card type
"number":"5105105105105100", // A trimmed and whitespaced-removed card number
"valid":true // If the number provided was valid (allows whitespace and dashes - use the returned number for a "clean" version of the card)
}Note: if you enter an invalid value, you will get an object like so:
{
valid: false,
number: ""
}See the example folder for how to integrate with jQuery validate
See the example folder for how to integrate with jQuery to automatically select the card type