Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Success function not being triggered? #31

Open
robp2175 opened this issue Nov 9, 2018 · 3 comments
Open

Success function not being triggered? #31

robp2175 opened this issue Nov 9, 2018 · 3 comments

Comments

@robp2175
Copy link

robp2175 commented Nov 9, 2018

For some reason neither the success for nor the error function is being called. I have reviewed #27 and #28, but neither were helpful to me. The information from the card has nothing in line 1, line 2 = ;004089025410=? and line 3 is empty. I might just be dense, but I am not sure where to look. The console.log only shows the output like

59: ;
IDLE -> PENDING2
 48: 0
PENDING2 -> READING
48: 0
52: 4
48: 0

etc.

I would appreciate any assistance. 
@robp2175
Copy link
Author

robp2175 commented Nov 9, 2018

Forgot to mention, that I am using simple-demo.html without any changes and the defaultSuccessCallback is firing with the alert var text = ['Line 1: ', cardData.line1, '\nLine 2: ', cardData.line2, '\nLine 3: ', cardData.line3].join('');

@CarlRaymond
Copy link
Owner

I tried that sequence in a test case, and the generic parser matched it.

The fact that you're seeing an alert means that the success callback was invoked - that's where the alert comes from. But if it shows literally var text = ['Line 1:... then the code isn't getting parsed properly. What browser are you using?

@JamoCA
Copy link

JamoCA commented Oct 21, 2019

I believe that the function on this page:
https://github.com/CarlRaymond/jquery.cardswipe/blob/master/demo-simple.html

Since there isn't any "complete" method, it should be replaced with "success":

Should be updated from:

$.cardswipe({
    firstLineOnly: false,
    complete: success,
    parsers: [ "visa", "mastercard", "amex", "discover", "generic" ],
    error: error,
    debug: true
});

to this:

$.cardswipe({
    firstLineOnly: false,
    success: success,
    parsers: [ "visa", "mastercard", "amex", "discover", "generic" ],
    error: error,
    debug: true
});

As soon as I changed the demo-simple.html example to use success instead of complete, it worked. (I initially thought something else was broken until I took the time to troubleshoot why it wasn't displayed data like the demo-events.html example was.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants