I am having a shopping cart text update issue on an ASP.NET MVC2 ecommerce site. When a user wants to add an item, a user control pop-up allows them to choose certain options and then click on “add to cart”.
$(document).ready(function () {
$('#sizeselectform :radio:first').attr('checked', 'checked');
$('#sizeselectform').ajaxForm(function () {
$('#sizeselectform').parents('div.popup').children('a.close').click();
UpdateCartCount();
});
});
The UpdateCartCount function just updates the count of items in a shopping cart:
function UpdateCartCount() {
$.ajax({
type: "GET",
url: "/ShoppingCart/GetCartItemsCount/",
success: function (result, status, xmlHttpRequest) {
$('#cartItemCount').text(result);
},
error: function (xmlHttpRequest, status, e) {
var errorMessage = 'Login: ' + xmlHttpRequest.status + ' - ' + xmlHttpRequest.statusText;
$('#loginErrorMessage').html(errorMessage).show();
},
complete: function (xmlHttpRequest, status) {
}
});
}
Everything works fine in Chrome, Firefox,etc except IE7. I suspect that the cart count is not updated in IE7 because the parent div is closed before called the UpdateCartCount() function but at this point I am not sure. Any suggestions?
Thanks,
EDIT:
I changed the call to POST, added a cache: ‘false’, content-type: ‘application/text’, and finally a random number to the URL to prevent caching (all suggested solutions to this IE issue)…and the ajax calls finally started working in IE.
I changed the call to POST, added a cache: ‘false’, content-type: ‘application/text’, and finally a random number to the URL to prevent caching (all suggested solutions to this IE issue)…and the ajax calls finally started working in IE.