I have problems with ajax json and Internet Explorer requests. In particular, ajax requests are not behaving correctly.
I use:
OpenCart 1.5.3.1
JQuery-1.7.1.min.js
Jquery-u-1.8.16.custom.min.js
Internet Explorer 9
PHP 5.2.9
This is the request function:
function addToCart(product_id, quantity, option_id, option_value) { quantity = typeof(quantity) != 'undefined' ? quantity : 1; option_value = typeof(option_value) != 'undefined' ? option_value : 0; option_id = typeof(option_id) != 'undefined' ? option_id : 0; jQuery.ajax({ url: 'index.php?route=checkout/cart/add', type: 'post', cache: false, data: 'product_id=' + product_id + '&quantity=' + quantity + '&option_id=' + option_id + '&option_value=' + option_value+'&rnd=' + Math.random(), dataType: 'json', success: function(jsonObj) { $('.success, .warning, .attention, .information, .error').remove(); if (jsonObj['redirect']) { location = jsonObj['redirect']; } if (jsonObj['success']) { $('#notification').html('<div class="success" style="display: none;">' + jsonObj['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>'); $('.success').fadeIn('slow'); $('#cart-total').html(jsonObj['total']); $('html, body').animate({ scrollTop: 0 }, 'slow'); } } }); }
PHP return function:
{"success":"Added to cart!","total":"1 product(s) - 52,48\u043b\u0432."}
All this works fine in Chrome, FF, etc., but doesn't work in IE.
In fact, IE does not fire the Success event.
The only way to get the answer is through an error handler.
Then the json object has status = 200 and statusText = OK
This is the json object after the event of the event fired in Chrome:
jsonObj: Object success: "Added to cart!" total: "1 product(s) - 52.48." __proto__: Object
From which the values โโof "success" and "total" are used.
This is a json object after the error event has been handled in Internet Explorer:

ReplyText is a string containing the current source of the html page.
I tried with jQuery.ajaxSetup({cache: false}); but the result is the same.
Has anyone had this problem? Or any tips?
I have no more ideas.