문제

We are facing problem sometimes on Product Details Page: (We are facing issue to load images on all product detail page i.e. from where customer can buy product) We are getting below piece of errors on the console

    {
    Failed to load resource: the server responded with a status of 404 (Not Found) 
    Uncaught TypeError: Object [object Object] has no method 'autocomplete' 
    Uncaught TypeError: Object [object Object] has no method 'jCarouselLite' 
    }

Please help.

My code is given below.

-----Javascript Code START------

<script src="js/validate.js"></script>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
<script src="js/jcarousellite_1.0.1c4.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function() {
        document.title="<?php echo $product['pd_name']; ?>";
        $(".newsticker-jcarousellite").jCarouselLite({
            vertical: true,
            hoverPause:true,
            visible: 4,
            auto:500,
            speed:1500
        });

        var hh=$(".image_preview_img_text").height();
        if(hh<=300)
        {
            //$("#tag_rt_new").height("");
            $("#tag_rt_new").css("padding-top","300px");
        }

        $("#tag_rt_new").show();
        $(".index_left_nav_new").remove();
    });
</script>
<script src="js/jcarousellite_1.0.1c4.js" type="text/javascript"></script>
<script>
    $(document).ready(function(){
        err_msg_pp();
        $(".cart_tmp_msg_div_pp").css("height","0px");
        $(".cart_tmp_msg_div_pp").css("padding","0px");
        $(".cart_left").find("div").nextAll('br').remove();
        $(".cart_left").find("div div br").remove();
        $(".description ul br").remove()
        $(".description li").css("padding","5px");
        $(".cart_left div div").css("padding-bottom","4px");
        change_image_color( <?php echo $_GET['p'];?>,
            document.getElementById("first_col_name").value,
            document.getElementById("colid").value
        );
    });

</script>
<script type="text/javascript">
var flag=0;
var loader='<img src="admin/images/382.gif" style="padding-left: 
20%;padding-top: 25%;"/>';

----END----

도움이 되었습니까?

해결책 2

Finally I got it right. You were right @MatthewWilcoxson as the jquery -1.9.1 has been added four time on different pages. I dont know why this problem was not permanent. Anyways, the problem was to have jQuery included multiple times and by removing the same, it solved the issue.

다른 팁

Some general tips: 1. Try to get your setup code all in one place with just one document.ready function. This makes debugging easier. 2. Only load a javascript library once. You'll likely confuse the browsers. 3. Try to limit the amount of scripts you are using.

With the code you've added you could try refactoring to this:

<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />

<script src="js/validate.js" type="text/javascript"></script>
<script src="js/jcarousellite_1.0.1c4.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function(){

        document.title="<?php echo $product['pd_name']; ?>";
        $(".newsticker-jcarousellite").jCarouselLite({
            vertical: true,
            hoverPause:true,
            visible: 4,
            auto:500,
            speed:1500
        });

        var hh=$(".image_preview_img_text").height();
        if(hh<=300)
        {
            //$("#tag_rt_new").height("");
            $("#tag_rt_new").css("padding-top","300px");
        }

        $("#tag_rt_new").show();
        $(".index_left_nav_new").remove();

        err_msg_pp();
        $(".cart_tmp_msg_div_pp").css("height","0px");
        $(".cart_tmp_msg_div_pp").css("padding","0px");
        $(".cart_left").find("div").nextAll('br').remove();
        $(".cart_left").find("div div br").remove();
        $(".description ul br").remove()
        $(".description li").css("padding","5px");
        $(".cart_left div div").css("padding-bottom","4px");
        change_image_color( <?php echo "something";?>,
            document.getElementById("first_col_name").value,
            document.getElementById("colid").value
        );
    });
</script>

If you have other code that is attempting to load "js/jcarousellite_1.0.1c4.js" then remove it. The code within the $(document).ready should run after all the javascript is loaded.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top