Can credit card type be determined solely from the credit card number?
Is this recommended or should we always ask client for the type of credit card they\'re using?
here is the script that i use that works with current card ranges. also does a validity check on the number.
/**
* checks a given string for a valid credit card
* @returns:
* -1 invalid
* 1 mastercard
* 2 visa
* 3 amex
* 4 diners club
* 5 discover
* 6 enRoute
* 7 jcb
*/
function checkCC(val) {
String.prototype.startsWith = function (str) {
return (this.match("^" + str) == str)
}
Array.prototype.has=function(v,i){
for (var j=0;j