AJAX Request is freezing mobile broswer ( working on desktop )

Viewed 34

I am having a bit of trouble with an ajax request, seems to work in all desktop browsers, however when testing on mobile it will freeze my phone, It will not even let me navigate away from the webpage without closing the window and opening a new one. Any help would be amazing.

Let me know if you need more info.

              postURL = "/cart/add.js";
          dataToPost = {quantity:1, id:ProdID};
          $.ajax
          ({
            type: "POST",
            url: postURL,
            data: dataToPost,
            dataType:'json',
            success: function(){
               $.ajax({
                type: 'GET',
                url: '/cart.js',
                dataType: 'json',
                contentType: "application/json",
                success: function(data) { 
                  cartLen = data.item_count;
                  cartPrice = ((data.total_price /100)*.9).toFixed(2);

                     $('#cartCount').html(cartLen);
                     $('#cartCountMobile').html(cartLen);
                     $('#cartPrice').html("("+"$"+cartPrice+")");
                     $('#cartPriceMobile').html("("+"$"+cartPrice+")");

                }
            });
            },
            error: function(e){
                console.log('ERROR! ', e);
            }
          });
0 Answers
Related