Avatar of Robert Granlund
Robert GranlundFlag for United States of America asked on

jQuery Issue

I have posted a few times about a Google API issue and I have narrowed it down.

Apparently to get the Google Map API on any browser you do not need to include document ready.  The Initialize Map function ( function initMap() )  has a function nested in it called  ( function countriesLoad() ) LINE 24.

The code below works in all browsers but IE 9.  The  ( function countriesLoad() ) does not fire.  Everything else does.

Any suggestions?

<script>
var map;

function initMap() {


  map = new google.maps.Map(document.getElementById('map'), {
    zoom: 1,
    center: {lat: 0, lng: 0}
  });
  map.setOptions({styles: styles});

var countries = [];
var states = [];
var cities = [];
function unique(array) {
    return $.grep(array, function(el, index) {
        return index === $.inArray(el, array);
    });
}

 

function countriesLoad() {
  jQuery.each(json_data.features, function() {
      countries = countries.concat((jQuery(this)[0].properties.countriesSupported));
      states = states.concat((jQuery(this)[0].properties.state));
      cities = cities.concat((jQuery(this)[0].properties.city));
    });
  console.log(countries);
  countries = countries.filter(Boolean);
  console.log(countries);

  countries = unique(countries);
  console.log(countries);
  countries = countries.sort();
  console.log(countries);
  states = states.filter(Boolean);
  states = jQuery.unique(states);
  states = states.sort();
  cities = cities.filter(Boolean);
  cities = jQuery.unique(cities);
  cities = cities.sort();
  //<option value="australia">Australia</option>
  
  for (i = 0; i < countries.length; i++) {
     
    $("#country_select").append('<option value="' + countries[i] + '">' + countries[i] +'</option>');
    $("#country_select_2").append('<option value="' + countries[i] + '">' + countries[i] +'</option>');

  }

  for (i = 0; i < states.length; i++) {
    jQuery("#state_select").append('<option value="' + states[i] + '">' + states[i] +'</option>');
  }
  for (i = 0; i < cities.length; i++) {
    jQuery("#city_select").append('<option value="' + cities[i] + '">' + cities[i] +'</option>');
  }

};




};

Open in new window

jQueryJavaScript

Avatar of undefined
Last Comment
Robert Granlund

8/22/2022 - Mon
Rob

Typically it is good to put your script in a document ready so that the code knows that all the markup is there are ready for it.  If you include your script at the end of the body, it has the same effect.

That said, when do you expect countriesLoad to run?  You've defined it, but I don't see anywhere where you've called it?

Both the countriesLoad and unique functions lose their scope after initMap has finished running so you either need to call them from inside initMap or move them outside of the scope and call them at a later stage.  I suggest trying the following:

<script>
var map;

function initMap() {


  map = new google.maps.Map(document.getElementById('map'), {
    zoom: 1,
    center: {lat: 0, lng: 0}
  });
  map.setOptions({styles: styles});

var countries = [];
var states = [];
var cities = [];
function unique(array) {
    return $.grep(array, function(el, index) {
        return index === $.inArray(el, array);
    });
}

 

function countriesLoad() {
  jQuery.each(json_data.features, function() {
      countries = countries.concat((jQuery(this)[0].properties.countriesSupported));
      states = states.concat((jQuery(this)[0].properties.state));
      cities = cities.concat((jQuery(this)[0].properties.city));
    });
  console.log(countries);
  countries = countries.filter(Boolean);
  console.log(countries);

  countries = unique(countries);
  console.log(countries);
  countries = countries.sort();
  console.log(countries);
  states = states.filter(Boolean);
  states = jQuery.unique(states);
  states = states.sort();
  cities = cities.filter(Boolean);
  cities = jQuery.unique(cities);
  cities = cities.sort();
  //<option value="australia">Australia</option>
  
  for (i = 0; i < countries.length; i++) {
     
    $("#country_select").append('<option value="' + countries[i] + '">' + countries[i] +'</option>');
    $("#country_select_2").append('<option value="' + countries[i] + '">' + countries[i] +'</option>');

  }

  for (i = 0; i < states.length; i++) {
    jQuery("#state_select").append('<option value="' + states[i] + '">' + states[i] +'</option>');
  }
  for (i = 0; i < cities.length; i++) {
    jQuery("#city_select").append('<option value="' + cities[i] + '">' + cities[i] +'</option>');
  }

};

countriesLoad(); // <==================== CALL IT AT THE BOTTOM OF THE initMap function


};

Open in new window

ASKER
Robert Granlund

That did not work.  The issue is, if I wrap it in document ready, it wont work in IE 9.  Taking the country function outside of the map function causes all browsers to break.  I will continue to mess with it though.  Any additional comments will be welcomed.
Rob

Did you put your script at the bottom of the page, right before the </body> element?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Justin Pilditch

Can you show the JSON code and the request (presumably AJAX) for it.
And can you supply a sample of the JSON countries data being return
ASKER
Robert Granlund

Here is the entire code.  Please keep in mind it is the Append of Countries that is not showing up and the only browser it is not working in is IE 9.
var map;

function initMap() {

var styles = [
    {
        "featureType": "administrative",
        "elementType": "all",
        "stylers": [
            {
                "visibility": "on"
            }
        ]
    },
    {
        "featureType": "administrative",
        "elementType": "geometry",
        "stylers": [
            {
                "visibility": "simplified"
            }
        ]
    },
    {
        "featureType": "administrative",
        "elementType": "geometry.fill",
        "stylers": [
            {
                "visibility": "off"
            }
        ]
    },
    {
        "featureType": "administrative",
        "elementType": "geometry.stroke",
        "stylers": [
            {
                "visibility": "simplified"
            }
        ]
    },
    {
        "featureType": "administrative",
        "elementType": "labels",
        "stylers": [
            {
                "weight": "1.00"
            }
        ]
    },
    {
        "featureType": "administrative",
        "elementType": "labels.text",
        "stylers": [
            {
                "color": "#b6b6b6"
            },
            {
                "weight": "0.26"
            }
        ]
    },
    {
        "featureType": "administrative.country",
        "elementType": "geometry.fill",
        "stylers": [
            {
                "visibility": "on"
            },
            {
                "color": "#a93787"
            }
        ]
    },
    {
        "featureType": "landscape",
        "elementType": "all",
        "stylers": [
            {
                "hue": "#FFBB00"
            },
            {
                "saturation": 43.400000000000006
            },
            {
                "lightness": 37.599999999999994
            },
            {
                "gamma": 1
            }
        ]
    },
    {
        "featureType": "landscape.man_made",
        "elementType": "all",
        "stylers": [
            {
                "visibility": "off"
            }
        ]
    },
    {
        "featureType": "landscape.natural.terrain",
        "elementType": "all",
        "stylers": [
            {
                "visibility": "off"
            }
        ]
    },
    {
        "featureType": "landscape.natural.terrain",
        "elementType": "geometry",
        "stylers": [
            {
                "visibility": "off"
            }
        ]
    },
    {
        "featureType": "landscape.natural.terrain",
        "elementType": "geometry.stroke",
        "stylers": [
            {
                "visibility": "off"
            }
        ]
    },
    {
        "featureType": "landscape.natural.terrain",
        "elementType": "labels",
        "stylers": [
            {
                "visibility": "off"
            }
        ]
    },
    {
        "featureType": "poi",
        "elementType": "all",
        "stylers": [
            {
                "hue": "#00FF6A"
            },
            {
                "saturation": -1.0989010989011234
            },
            {
                "lightness": 11.200000000000017
            },
            {
                "gamma": 1
            },
            {
                "visibility": "off"
            }
        ]
    },
    {
        "featureType": "poi.attraction",
        "elementType": "geometry.stroke",
        "stylers": [
            {
                "color": "#f52121"
            }
        ]
    },
    {
        "featureType": "road.highway",
        "elementType": "all",
        "stylers": [
            {
                "hue": "#FFC200"
            },
            {
                "saturation": -61.8
            },
            {
                "lightness": 45.599999999999994
            },
            {
                "gamma": 1
            }
        ]
    },
    {
        "featureType": "road.arterial",
        "elementType": "all",
        "stylers": [
            {
                "hue": "#FF0300"
            },
            {
                "saturation": -100
            },
            {
                "lightness": 51.19999999999999
            },
            {
                "gamma": 1
            }
        ]
    },
    {
        "featureType": "road.local",
        "elementType": "all",
        "stylers": [
            {
                "hue": "#FF0300"
            },
            {
                "saturation": -100
            },
            {
                "lightness": 52
            },
            {
                "gamma": 1
            }
        ]
    },
    {
        "featureType": "water",
        "elementType": "all",
        "stylers": [
            {
                "saturation": -13.200000000000003
            },
            {
                "lightness": 2.4000000000000057
            },
            {
                "gamma": 1
            },
            {
                "visibility": "simplified"
            },
            {
                "weight": "0.01"
            },
            {
                "hue": "#0078FF"
            }
        ]
    },
    {
        "featureType": "water",
        "elementType": "geometry",
        "stylers": [
            {
                "lightness": "12"
            }
        ]
    },
    {
        "featureType": "water",
        "elementType": "geometry.fill",
        "stylers": [
            {
                "color": "#d0eaf6"
            }
        ]
    }
];
  map = new google.maps.Map(document.getElementById('map'), {
    zoom: 1,
    center: {lat: 0, lng: 0}
  });
  map.setOptions({styles: styles});

var countries = [];
var states = [];
var cities = [];
function unique(array) {
    return $.grep(array, function(el, index) {
        return index === $.inArray(el, array);
    });
}

 

function countriesLoad() {
  jQuery.each(json_data.features, function() {
      countries = countries.concat((jQuery(this)[0].properties.countriesSupported));
      states = states.concat((jQuery(this)[0].properties.state));
      cities = cities.concat((jQuery(this)[0].properties.city));
    });
  console.log(countries);
  countries = countries.filter(Boolean);
  console.log(countries);

  countries = unique(countries);
  console.log(countries);
  countries = countries.sort();
  console.log(countries);
  states = states.filter(Boolean);
  states = jQuery.unique(states);
  states = states.sort();
  cities = cities.filter(Boolean);
  cities = jQuery.unique(cities);
  cities = cities.sort();
  //<option value="australia">Australia</option>
  
  for (i = 0; i < countries.length; i++) {
     
    $("#country_select").append('<option value="' + countries[i] + '">' + countries[i] +'</option>');
    $("#country_select_2").append('<option value="' + countries[i] + '">' + countries[i] +'</option>');

  }

  for (i = 0; i < states.length; i++) {
    jQuery("#state_select").append('<option value="' + states[i] + '">' + states[i] +'</option>');
  }
  for (i = 0; i < cities.length; i++) {
    jQuery("#city_select").append('<option value="' + cities[i] + '">' + cities[i] +'</option>');
  }

};


  map.data.loadGeoJson('/ajax/google_finder.php');
  $.ajax({
    url: '/ajax/google_finder.php',
    dataType: 'json',
    success: function(data){
       var json_data = data;
       window.json_data = json_data;
       countriesLoad();
    }
  });
 

  var infowindow = new google.maps.InfoWindow({
    content: 'contentString'
  });

  var marker = new google.maps.Marker({

  });
  marker.addListener('click', function() {
    infowindow.open(map, marker);
  });
  // When the user clicks, open an infowindow
  map.data.addListener('click', function(event) {
          var name = event.feature.getProperty("name");
          var address = event.feature.getProperty("address");
          var city = event.feature.getProperty("city");
          var state = event.feature.getProperty("state");
          var country = event.feature.getProperty("country");
          var zip = event.feature.getProperty("zip");
          var url = event.feature.getProperty("url");
          var salesPhone = event.feature.getProperty("salesPhone");
          var salesEmail = event.feature.getProperty("salesEmail");
          var countriesSupported = event.feature.getProperty("countriesSupported");
          var onsiteSupportPhone = event.feature.getProperty("onsiteSupportPhone");
          var onsiteSupportEmail = event.feature.getProperty("onsiteSupportEmail");
          var phoneSupportPhone = event.feature.getProperty("phoneSupportPhone");
          var phoneSupportEmail = event.feature.getProperty("phoneSupportEmail");
          var productsSupported = event.feature.getProperty("productsSupported");
          var laserSystemsPhone = event.feature.getProperty("laserSystemsPhone");
          var laserSystemsEmail = event.feature.getProperty("laserSystemsEmail");
          var laserMeasurementPhone = event.feature.getProperty("laserMeasurementPhone");
          var laserMeasurementEmail = event.feature.getProperty("laserMeasurementEmail");
          countriesSupported = countriesSupported.toString();
          countriesSupported = countriesSupported.replace(/,/g, ", ");
          productsSupported = productsSupported.toString();
          productsSupported = productsSupported.replace(/,/g, ", ");
      infowindow.setContent("<div id='iw-container'><div class='iw-title'><div style='text-align: center;'>"+name+"</div></div><div style='text-align: center;'>"+address+"</div><div style='text-align: center;'>"+city+", "+state+" "+zip+"</div><div style='text-align: center;'>"+country+"</div><div style='text-align: center;'><a href='http://"+url+"' target='_blank'>"+url+"</a></div><div style=' text-align: center;'>Sales Phone: "+salesPhone+"</div><div style='text-align: center;'>Sales Email: "+salesEmail+"</div><div style='text-align: center;'>Countries Supported: "+countriesSupported+"</div><div style='text-align: center;'>Onsite Support Phone: "+onsiteSupportPhone+"</div><div style='text-align: center;'>Onsite Support Email: "+onsiteSupportEmail+"</div><div style='text-align: center;'>Phone Support Phone: "+phoneSupportPhone+"</div><div style='text-align: center;'>Phone Support Email: "+phoneSupportEmail+"</div><div style='text-align: center;'>Products Supported: "+productsSupported+"</div><div style='text-align: center;'>Laser Systems Phone: "+laserSystemsPhone+"</div><div style='text-align: center;'>Laser Systems Email: "+laserSystemsEmail+"</div><div style='text-align: center;'>Laser Measurement Phone: "+laserMeasurementPhone+"</div><div style='text-align: center;'>Laser Measurement Email: "+laserMeasurementEmail+"</div></div>");
          infowindow.setPosition(event.feature.getGeometry().get());
      infowindow.setOptions({pixelOffset: new google.maps.Size(0,-30)});
          infowindow.open(map);
  });    
  function refreshMap(json) {
    map = new google.maps.Map(document.getElementById('map'), {
    zoom: 1,
    center: {lat: 0, lng: 0}
  });
  map.setOptions({styles: styles});


  map.data.addGeoJson(json);

 

  var infowindow = new google.maps.InfoWindow({
    content: 'contentString'
  });

  var marker = new google.maps.Marker({

  });
  marker.addListener('click', function() {
    infowindow.open(map, marker);
  });
  // When the user clicks, open an infowindow
  map.data.addListener('click', function(event) {
          var name = event.feature.getProperty("name");
          var address = event.feature.getProperty("address");
          var city = event.feature.getProperty("city");
          var state = event.feature.getProperty("state");
          var country = event.feature.getProperty("country");
          var zip = event.feature.getProperty("zip");
          var url = event.feature.getProperty("url");
          var salesPhone = event.feature.getProperty("salesPhone");
          var salesEmail = event.feature.getProperty("salesEmail");
          var countriesSupported = event.feature.getProperty("countriesSupported");
          var onsiteSupportPhone = event.feature.getProperty("onsiteSupportPhone");
          var onsiteSupportEmail = event.feature.getProperty("onsiteSupportEmail");
          var phoneSupportPhone = event.feature.getProperty("phoneSupportPhone");
          var phoneSupportEmail = event.feature.getProperty("phoneSupportEmail");
          var productsSupported = event.feature.getProperty("productsSupported");
          var laserSystemsPhone = event.feature.getProperty("laserSystemsPhone");
          var laserSystemsEmail = event.feature.getProperty("laserSystemsEmail");
          var laserMeasurementPhone = event.feature.getProperty("laserMeasurementPhone");
          var laserMeasurementEmail = event.feature.getProperty("laserMeasurementEmail");
          countriesSupported = countriesSupported.toString();
          countriesSupported = countriesSupported.replace(/,/g, ", ");
          productsSupported = productsSupported.toString();
          productsSupported = productsSupported.replace(/,/g, ", ");
      infowindow.setContent("<div id='iw-container'><div class='iw-title'><div style='text-align: center;'>"+name+"</div></div><div style='text-align: center;'>"+address+"</div><div style='text-align: center;'>"+city+", "+state+" "+zip+"</div><div style='text-align: center;'>"+country+"</div><div style='text-align: center;'><a href='http://"+url+"' target='_blank'>"+url+"</a></div><div style=' text-align: center;'>Sales Phone: "+salesPhone+"</div><div style='text-align: center;'>Sales Email: "+salesEmail+"</div><div style='text-align: center;'>Countries Supported: "+countriesSupported+"</div><div style='text-align: center;'>Onsite Support Phone: "+onsiteSupportPhone+"</div><div style='text-align: center;'>Onsite Support Email: "+onsiteSupportEmail+"</div><div style='text-align: center;'>Phone Support Phone: "+phoneSupportPhone+"</div><div style='text-align: center;'>Phone Support Email: "+phoneSupportEmail+"</div><div style='text-align: center;'>Products Supported: "+productsSupported+"</div><div style='text-align: center;'>Laser Systems Phone: "+laserSystemsPhone+"</div><div style='text-align: center;'>Laser Systems Email: "+laserSystemsEmail+"</div><div style='text-align: center;'>Laser Measurement Phone: "+laserMeasurementPhone+"</div><div style='text-align: center;'>Laser Measurement Email: "+laserMeasurementEmail+"</div></div>");
          infowindow.setPosition(event.feature.getGeometry().get());
      infowindow.setOptions({pixelOffset: new google.maps.Size(0,-30)});
          infowindow.open(map);
          map.setZoom(7);
  });   
  var results_html = '';
  var jsonLength = json.features.length;
  //console.log(json);
  for (var i = 0; i < jsonLength; i++) {
        var name = json.features[i].properties.name;
        var address = json.features[i].properties.address;
        var city = json.features[i].properties.city;
        var state = json.features[i].properties.state;
        var country = json.features[i].properties.country;
        var zip = json.features[i].properties.zip;
        var url = json.features[i].properties.url;
        var salesPhone = json.features[i].properties.salesPhone;
        var salesEmail = json.features[i].properties.salesEmail;
        var countriesSupported = json.features[i].properties.countriesSupported;
        var onsiteSupportPhone = json.features[i].properties.onsiteSupportPhone;
        var onsiteSupportEmail = json.features[i].properties.onsiteSupportEmail;
        var phoneSupportPhone = json.features[i].properties.phoneSupportPhone;
        var phoneSupportEmail = json.features[i].properties.phoneSupportEmail;
        var productsSupported = json.features[i].properties.productsSupported;
        var laserSystemsPhone = json.features[i].properties.laserSystemsPhone;
        var laserSystemsEmail = json.features[i].properties.laserSystemsEmail;
        var laserMeasurementPhone = json.features[i].properties.laserMeasurementPhone;
        var laserMeasurementEmail = json.features[i].properties.laserMeasurementEmail;
        countriesSupported = countriesSupported.toString();
        countriesSupported = countriesSupported.replace(/,/g, ", ");
        productsSupported = productsSupported.toString();
        productsSupported = productsSupported.replace(/,/g, ", ");
        // results_html += '<div class="results_cont">'+'<div class="iw-title">'+name+'</div>'+'<div>'+address+'</div>'+'<div>'+city+'</div>'+'<div>'+state+'</div>'+'<div>'+country+'</div>'+'<div>'+zip+'</div>'+'<div>'+url+'</div>'+'<div>'+salesPhone+'</div>'+'<div>'+salesEmail+'</div>'+'<div>Countries Supported: '+countriesSupported+'</div>'+'<div>'+onsiteSupportPhone+'</div>'+'<div>'+onsiteSupportEmail+'</div>'+'<div>'+phoneSupportPhone+'</div>'+'<div>'+phoneSupportEmail+'</div>'+'<div>Products Supported: '+productsSupported+'</div>'+'<div>'+laserSystemsPhone+'</div>'+'<div>'+laserSystemsEmail+'</div>'+'<div>'+laserMeasurementPhone+'</div>'+'<div>'+laserMeasurementEmail+'</div>'+'</div>';
        results_html += '<div class="results_cont">'+'<div class="iw-title">'+name+'</div>'+'<div class="iw-address"><div>'+address+'</div>'+'<div>'+city+'</div>'+'<div>'+state+'</div>'+'<div>'+country+'</div>'+'<div>'+zip+'</div></div>'+'<div class="iw-salesContact"><div>'+url+'</div>'+'<div>'+salesPhone+'</div>'+'<div>'+salesEmail+'</div></div>'+'<div class="iw-countries">Countries Supported: '+countriesSupported+'</div>'+'<div class="iw-supportContact"><div>'+phoneSupportPhone+'</div>'+'<div>'+phoneSupportEmail+'</div></div>'+'<div it="iw-products">Products Supported: '+productsSupported+'</div>'+'<div class="iw-lasers"><div>'+laserSystemsPhone+'</div>'+'<div>'+laserSystemsEmail+'</div>'+'<div>'+laserMeasurementPhone+'</div>'+'<div>'+laserMeasurementEmail+'</div></div>'+'</div>';
  }; 
  if (results_html.length < 1) {
    results_html = '<div class="results_cont">No matching search results. Please try again.</div>'
  }
  $('#results').html(results_html);
}
$('#country_select_2').change(function() {
  console.log($('#country_select_2 option:selected').text());
  $('#country_select').val($('#country_select_2 option:selected').text());
  if(jQuery().modal) {
    $('#supportModal').modal('show');
  }
  buildMap();
  
  

});
$('#country_select').change(function() {
  console.log($('#country_select option:selected').text());
  $('#country_select_2').val($('#country_select option:selected').text());
  buildMap();
});

function buildMap() {
  // Build JSON URL
  var country = $('#country_select option:selected').text();
  var product = $('#product_select option:selected').text();
  var support = $('#support_select option:selected').text();
  var city = $('#city_select option:selected').text();
  var state = $('#state_select option:selected').text();
  var country_del = false;
  var product_del = false;
  var city_del = false;
  var state_del = false;

  // Remove array entries from json_data based on selected options
  var temp_data = jQuery.extend(true, {}, json_data);
  var arrayLength = temp_data.features.length;
  for (var i = arrayLength - 1; i >= 0 ; i--) {
    if (country !== ' -- Select a Country -- ') {
      if (jQuery.inArray(country, temp_data.features[i].properties.countriesSupported) === -1 && country !== 'All Countries') {
        country_del = true;
      }
      else {
        country_del = false;
      }
    }
    // if (product !== ' -- Select a Product -- ') {
    //   if (jQuery.inArray(product, temp_data.features[i].properties.productsSupported) === -1 && product !== 'All Products') {
    //     product_del = true;
    //   }
    //   else {
    //     product_del = false;
    //   }
    // }
    // if (city !== ' -- Select a City -- ') {
    //   if (jQuery.inArray(city, temp_data.features[i].properties.city) === -1 && city !== 'All Cities') {
    //     city_del = true;
    //   }
    //   else {
    //     city_del = false;
    //   }
    // }
    // if (state !== ' -- Select a State -- ') {
    //   if (jQuery.inArray(state, temp_data.features[i].properties.state) === -1 && state !== 'All States') {
    //     state_del = true;
    //   }
    //   else {
    //     state_del = false;
    //   }
    // }
    if (country_del || product_del || state_del || city_del ) {
      temp_data.features.splice(i,1);
    }
  };

  //Refresh Map
  refreshMap(temp_data);
}


};

Open in new window

ASKER CERTIFIED SOLUTION
Rob

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
Robert Granlund

I'm not using the states and Cities part of it.

I made the adjustment and still did not have any effect on it in IE9.  or any other browser.

And yes, it is at the bottom of the page, before the closing tag.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Robert Granlund

It is stopping here:    console.log(countries);
Once I took that out, everything worked fine in IE 9
Rob

we really need to see some sample json data please
Justin Pilditch

The reason we need to the JSON output is that it appears that it is something in that output that is causing the problem...
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER
Robert Granlund

console.log breaks IE9 and causes it to stop.
Once I took that out, everything worked fine in IE 9