0

I am developing an app for a company i work for but this ajax call only works on IE9+, FF, Chrome . I've been reading around without much luck. Here is the code i have.It is pretty simple:

var request_getShoppingCart = $.ajax({
    url:"classes/sCart.php?action=getItems",
    cache: false,

});
request_getShoppingCart.done(function(Data) {
    $('#shoppingCart').html(Data);
});

Any help is appreciated

Spudley
  • 166,037
  • 39
  • 233
  • 307
zeid10
  • 511
  • 8
  • 28

1 Answers1

4

IE fails with trailing comma.

var request_getShoppingCart = $.ajax({
    url:"classes/sCart.php?action=getItems",
    cache: false //remove comma here

});
request_getShoppingCart.done(function(Data) {
    $('#shoppingCart').html(Data);
});


Also read

jQuery .ajax method in IE7 & IE6 not working but working fine in Firefox

Does Internet Explorer 9 choke on extra commas at the end of array and object literals?

Community
  • 1
  • 1
Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
  • 1
    +1 This has been the bane of my existence since writing a load of jQuery plugins a while back, thinking it was a good idea to leave the trailing comma, so I don't have to think about adding it if I add more options. Not so clever now! – Reinstate Monica Cellio Nov 05 '13 at 14:34
  • 1
    Yup. It's fixed in IE8 and up. IE8 doesn't have the array fix (which wasn't a fix so much as a grey area in the spec they cleaned up in ES5), I *think* 9 does. – T.J. Crowder Nov 05 '13 at 14:35
  • took out the comma and add a fail method. No errors occurs. I am using version 1.10.1 ashould i go back to an earlier version? – zeid10 Nov 05 '13 at 14:37
  • @user1960170 What **is** happening and what **should** happen? – Anthony Grist Nov 05 '13 at 14:39
  • Yes, IE9 has the array fix/change. – T.J. Crowder Nov 05 '13 at 14:44
  • no data is returned from the call. If i use IE9 i get the data i am looking for. – zeid10 Nov 05 '13 at 14:46