繁体   English   中英

从JQuery Mobile 1.2.0更新到1.3.1,从Jquery 1.8.3更新到1.9.1,并收到错误消息“ ReferenceError:未定义$”

[英]Updated from JQuery Mobile 1.2.0 to 1.3.1 and Jquery 1.8.3 to 1.9.1 and got an error “ReferenceError: $ is not defined”

我是否需要更改$document.ready()或其他内容以应对更新,或者这仅仅是我的编码问题?

例如,这是我的代码的伪装。

$(document).ready(function () {

$("#product_page").click(function () {

    var product = $("#product-form").serialize();
    $.ajax({
        type:'POST',
        context:this,
        url:'add',
        dataType:"json",
        data:product,
        success:function (data) {
            console.log(data);
            if (data.success == true) {
                //console.log(data);

                $.mobile.changePage($(data.anchorpg));
                $(".app_results").html(data.app_id);

                $("#contact_id").val(data.contact_id);
                $("#is_joint").val(data.joint);
                //#applicant-info-page
                $("a.selector-2").prop("href", "#applicant-info-page");
                if (data.joint) {
                    $(".joint_view").css("display", "block");
                } else {
                    $(".joint_view").css("display", "none");
                }
            } else {

                $('#error-message').popup("open").text(data.error);
            }
        }

    });
    return false;
}); ...etc.

进一步的信息。 在我更新之前,它工作得很好。

尝试:

jQuery.noConflict();

更多信息: http : //api.jquery.com/jQuery.noConflict/

jQuery 1.9.1是一个较大的更新,它不赞成使用某些功能,例如,我将研究如何加载jQuery迁移并查看它提供了哪些反馈,它旨在帮助您进行准确的过渡。 github.com/jquery/jquery-migrate/#readme

很高兴为您提供帮助。 就像其他人在该线程上所说的那样,由于错误,jQuery迁移似乎不像是凭单,但是从1.x到1.9的迁移是一个很奇怪的问题,它解决了我的问题和WBaizer的问题,因此,如果迁移到jQuery 1.9时遇到问题

暂无
暂无

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

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