views:

35

answers:

0

Scenario: Drop down pre-populated, user can click to select items which refreshes content based on an array of id's obtained from anchors within a div.

EDIT #1:-

Okay okay, If I alert out items in the change event they will work in FF, IE alerts them out but just doesn't assign content to #panels as per the load content function. But, if I alert out data within the success portion.....it alerts it out.

Code that works in IE and FF:-

$("#tiers").change(function() {    
 var selectedId = $(this).val();
 var container = $('#tier'+selectedId+' a').map(function() { 
         var match = this.id.match(/\d+$/);
  return match ? match[0] : null;
 }).get();
 loadContent(container);
});

Code that works in FF but not IE:-

$("#tiers").change(function() {    
 var selectedId = $(this).val();
 panels = getSelectedTierPanels(selectedId);
 loadContent(panels);
});

My Load function:-

function loadContent(panels) {

 $("#panels").empty().html('<div id="loader">wedwefwef</div>');
 $.ajax({
  url: "admin.php",
  cache: false,
  data: ({
   'module':'data',
   'action':'panelsByClient',
   'data[]':panels
  }),
  success: function(data) {
   $("#panels").html(data);
  },
  error: function(XMLHttpRequest, textStatus, errorThrown) {
   if(status == "error") {
    var msg = "Sorry, but there was an error: ";
    $("#panels").html(msg + xhr.status + " " + xhr.statusText);
   }
  }
 });
}

My getSelectedTierPanels() function (courtesy of another subscriber):-

function getSelectedTierPanels(tierId) {
 var container = $('#tier'+tierId+' a').map(function() { 
 var match = this.id.match(/\d+$/);
  return match ? match[0] : null;
 }).get();
 return container;
}