0

I am getting the error stripecall is not defined even though function is defined and it is a global function:

Here is the code:

<button type="button" id="addcard" class="btn btn-success" 
     onclick="stripecall();">
    <i class="icon-save"></i> Submit
</button>

And function is defined like:

function stripecall() {
  // function stuff
}

What I've tried:

  • Tried enclusing whole form in <form></form> tags
  • Tried binding button click event via jQuery's click, live and on

Everything seems to be okay but still getting that func is not defined error.

Can someone help me what I am missing ?

Thanks for the help

3
  • 1
    You have multiple syntax errors in your JS, check that first with some debugger. isCreditCard function: else: mu --; should be else: muu--;. Also in stripeResponseHandler function at the end you have a doublequote left open. Commented Jan 29, 2014 at 13:08
  • First check your JS for errors then submit to SO. Commented Jan 29, 2014 at 13:09
  • @Fracsi: Thanks man you are so quick alone doublq quote was the issue :) Commented Jan 29, 2014 at 13:11

1 Answer 1

1

The function stripecall is never defined because you have a syntax error line 1425

else {
    alert(msg);
    $('.btn-success').css("display", "");
    $('#loading').css("display", "none");
}
//location.href = "editcontact/index/
"; // <--- this is the problem
});
Sign up to request clarification or add additional context in comments.

1 Comment

True that was the issue, @Fracsi already pointed that out but I will accept this as answer :) Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.