-2
$.ajax({
   url:"test.html",
   cache: false,
   success: function(html){
      $("#results").append(html);
   },
});      

There is a trailing comma at the end of the last key value pair (success:function). I want to know that Does Internet Explorer trailing comma. Code is working fine in google chrome and Mozilla Firefox. But I am getting JavaScript error "Expected Identifier, String or Number" in some cases. I want to know is the trailing comma is the reason for this error.

user94559
  • 59,196
  • 6
  • 103
  • 103
Atul Gupta
  • 75
  • 2
  • 10

1 Answers1

2

This has absolutely nothing to do with Ajax. It is entirely about the object literal:

{
  url:"test.html",
  cache: false,
  success: function(html){
    $("#results").append(html);
  },
}

A trailing comma in an object literal was forbidden until ES5.

Internet Explorer does not support them until version 9 (and possibly only when the Doctype triggers Standards Mode).

reference

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335