javascript - 调用 jQuery.i18n 库后,我收到 Uncaught TypeError : string is not a function in my login method

标签 javascript jquery html jsp internationalization

我正在使用 jQuery.i18n 来捆绑我的项目,我这样调用它

<script type="text/javascript">

    <% String locale =request.getSession().getAttribute("language").toString();%>
    $(document).ready(function () {
        loadBundles1('<%=locale.toLowerCase()%>');
    });

    function loadBundles1(lang11) {
        jQuery.i18n.properties({
         //   language:lang
        });
    }

</script>

它工作正常......但问题是当我尝试登录时出现此错误

未捕获的类型错误:当我单击登录按钮时,字符串不是函数,甚至没有调用 javascript 登录函数

我的表格

<form name="headerLoginForm" class="loginForm" method="post"
                                  action="JavaScript:login('headerLoginForm','${pageContext.request.contextPath}/login/login');">

我的按钮

<button id="loginButton2" type="submit" class="app-button ladda-button"
                                            data-style="expand-right"
                                            name="Submit">
                                        <span class="ladda-label"><fmt:message key="login" /></span>
                                    </button>

注意:当我注释掉 jQuery.i18n 代码时,登录工作正常

如何解决这个问题?

最佳答案

我现在通过将方法名称从login更改为login1解决了错误,但我不知道错误是什么?!

所以代码

action="JavaScript:登录 改为

action="JavaScript:login1

关于javascript - 调用 jQuery.i18n 库后,我收到 Uncaught TypeError : string is not a function in my login method,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24322767/

相关文章:

javascript - 图片加载时和加载后的尺寸不同

javascript - 当鼠标悬停在上面时,如何阻止 mouseOver 文本闪烁

javascript - 模拟/ stub 构造函数

asp.net - 使用 jquery 启用禁用 ASP.NET 验证控件

javascript - 使用 CSS 在导航栏上创建 "invisible"滚动条(隐藏不起作用)

jQuery - 将多个单词更改为多个图像

javascript - div 可以旋转,span 不能旋转但它可以动画转换

javascript - 从 HTML/CSS/JS 应用程序发送电子邮件

jquery - Bootstrap 一次获取两个下拉列表的值

jquery - Valums Ajax Uploader (Mutli) - 检测所有文件何时上传