dongyoucha0645 2018-05-11 09:08
浏览 128

jQuery没有在safari浏览器上工作,也没有在MAC中的chorome上工作

I have just finished a website and the link is http://techuire.com/portfolio/BlotHub/

The problem with this website is that the jQuery is not working on safari browser at all. The jQuery is not working on Chrome in MAC either.

How to test? Please open the above link on Chrome in a PC and then do the same on Chrome in MAC, or Safari. Go to combo deals and click on Add to Cart. The left side cart will not update on the later OS and Browsers. But will be loaded on Chrome in Windows PC.

I am mentioning my code for reference. This code gets executed when a user clicks on the "Add to Cart" Button

<script type="text/javascript">

  $(document).ready(function(){

                   $('.add_to_cart').click(function(){

                    var product_id= $(this).attr("id");
                    var product_name= $('#name'+product_id).val();
                    var product_price= $('#price'+product_id).val();
                    var product_image= $('#image'+product_id).val();
                    var product_quantity= $('#quantity'+product_id).val();
                    //alert(product_price);
                        $.ajax({

                            url:"includes/add_to_cart.php",
                            method:"POST",
                            data:{
                                product_id:product_id,
                                product_name:product_name,
                                product_price:product_price,
                                product_image:product_image,
                                product_quantity:product_quantity,
                            },
                              success: function(value)
                                    {
                                    swal("Success!", "Product added into cart!", "success");
                                    setInterval(function(){
                                    var quantity_id= $('#quantity_id').val();
                                    $('.quantity123').load("includes/fetch_quantity.php?id=" + $('#quantity_id').val()).fadeIn("slow");


                                    },500);

                                    }

                        });

                   });

                     setInterval(function(){
                    $('.popupcart').load("includes/fetch.php").fadeIn("slow");
                    //use in header pop_up_page

                    },500);

                 $('.add_to_cart').click(function() {
                    location.reload();
                    });


                     setInterval(function(){
                    $('.cart_products').load("includes/fetch.php").fadeIn("slow");
                    //use in header pop_up_page

                    }, 1000);


        });

        </script>

"add_to_cart.php" just returns some values from the database, that code is not relevant to this query.

Thanks in anticipation

enter image description here

  • 写回答

1条回答 默认 最新

  • donglian1982 2018-05-11 09:14
    关注

    I will suggest use class instead of id. Or add some postfix while generating dynamic ids

    You have multiples ids on same page #name, #city etc.

    评论

报告相同问题?

悬赏问题

  • ¥15 用三极管设计—个共射极放大电路
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示