If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I did provide the function in my op. Do you want the rest that performs the calculation?

So many questions, so little time ....
Where is 'Luhn' defined and what does it contain?
What calculations are being done in the Calculate() function?
What is the custom alert supposed to look like? Contents?
In your original post, you used Validate(test) as an argument to the function. Where did 'test' come from and why did you not use it in the function if you wanted to pass it?

Note also that your Calculate() function returns true or false, but it makes the comparison to be equal to an integer values from parseInt() function.
Since the boolean will never equal to the digit returned, you are destined to always get a false for that 'if' statement.

BTW: You should enclose your code between [ code] and [ /code] tags (without the spaces)
to make it easier to read, copy, test and retain format for other forum members.

I tried something similar, and tried your code but I still get a second "undefined" pop-up after the success or not success. Is there no way to surpress that?

Thanks.

My problem in trying to answer your questions revolves around trying to give full answers after being given snippets of code.

There are other areas of your code that may be giving you the 'undefined' display. Instead of saying something "didn't work", show us what you used that didn't work.
I can guess all day and solve the problem to my satisfaction, but it may not meet your criteria of success. Do you have a link to some live code?

Did you look at the error console to see which line(s) might give you an error?