简体   繁体   中英

javascript getting function undefined error

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

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
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM