Javascript callback function throws error “Callback is not a function” in firefox

It is because you are not always passing the callback into that method.

success: function (data) {
  var items = "";
  $.each(data, function (i, item) {
    items += "<option value=\"" + item.Value + "\">" + item.Text + "</option>";
  });
  $(childClass).html(items);
  $(childClass)[0].selectedIndex = 0;
  if(callback) callback();  //check before calling it. 
}

Leave a Comment