简体   繁体   English

javascript获取函数未定义错误

[英]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: 我收到了错误的stripecall is not defined尽管函数已定义并且是全局函数,但未定义:

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 尝试在<form></form>标记中包含整个表单
  • Tried binding button click event via jQuery's click , live and on 通过jQuery的clickliveon尝试绑定按钮click事件

Everything seems to be okay but still getting that func is not defined error. 一切似乎都还可以,但是仍然func is not defined获得该func is not defined错误。

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 从未定义函数stripecall,因为您有语法错误行1425

else {
    alert(msg);
    $('.btn-success').css("display", "");
    $('#loading').css("display", "none");
}
//location.href = "editcontact/index/
"; // <--- this is the problem
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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