Last active
December 15, 2015 05:19
-
-
Save JasonOffutt/5208530 to your computer and use it in GitHub Desktop.
Capturing CC type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function () { | |
$('#fooButton').click(function () { | |
var $ccLogos = $('.credit-card-logos'), | |
$ccType = $('#hfCardType'); | |
switch ($ccLogos.attr('class')) { | |
case 'is_visa': | |
$ccType.val('Visa'); | |
break; | |
case: 'is_mc': | |
$ccType.val('Master Card'); | |
break; | |
// and so on... | |
} | |
// Return true to allow the click event to pass through... | |
return true; | |
}); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<asp:HiddenField ID="hfCardType" runat="server"/> | |
<asp:Panel ID="View1" runat="server"> | |
<!-- your card selection script goes here... --> | |
<asp:LinkButton ID="fooButton" runat="server" Text="Foo" OnClick="fooButton_Click"/> | |
</asp:Panel> | |
<asp:Panel ID="View2" runat="server"> | |
<asp:Literal ID="lCardType" runat="server"/> | |
</asp:Panel> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void fooButton_Click(object sender, EventArgs e) | |
{ | |
lCardType.Text = hfCardType.Value; | |
View1.Visible = false; | |
View2.Visible = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment