0

I have a fairly standard jQuery get function that calls some other functions on done(). In modern browsers this all works well. In IE9, the object that I created at the same scope level as the get() function gets lost:

var movieData = {};
movieData.ajaxUrl = ...;
...

// get movie data using the api
$.get(movieData.ajaxUrl, function (data) {...
    movieData.cust = data.customer_id;
    movieData.type = (movieData.cust == 1 ? 'al' : 'custom');
    ...

}, 'json').done(function (data) {...

    // show the modal and load the player
    $('#AlMovieModal').modal('show').on('shown.bs.modal', function (e) {
        setPlayerHt(this);

        if (movieData.type == 'al') {

The value of movieData and movieData.type are available all the way up to the modal() function call. Once inside, those values become undefined, in IE9 only.

What am I missing regarding object/variable scope and older IE? Thanks.

isherwood
  • 58,414
  • 16
  • 114
  • 157
  • As you didn't post the complete code: Is it just possible that you have a console.log message in your js and IE developer tools closed in IE? As IE has no console object in case of closed dev. tools, this can cause js-errors. – matthias_h Oct 03 '14 at 19:32
  • Ah! Yes there are--in a function called from that area. I'll investigate. – isherwood Oct 03 '14 at 19:34
  • No luck. They occur prior to the `get` function and commenting them out didn't help. – isherwood Oct 03 '14 at 19:38
  • Ok..2nd guess would be that it's possibly a caching issue. Just check the proposal in the top answer here, maybe worth a try: http://stackoverflow.com/questions/5996702/ajax-problem-in-ie9 – matthias_h Oct 03 '14 at 19:47
  • Hmmm... Trying this: http://stackoverflow.com/a/8841545/1264804 – isherwood Oct 03 '14 at 20:12
  • No luck there, either. I tried an ajax call with cache disabled. Same result. – isherwood Oct 03 '14 at 20:27

0 Answers0