jQuery .get and .append in IE7 makes current content disappear

314 Views Asked by At

The code works on Firefox, Safari, Chrome and IE8+ but not in IE7. It causes the content to disappear. I have tried developer tools in IE and if I locate one of the rows in the content and add any CSS to it, the content reappears.

I call the following code on a scroll event. when the $(document).scrollTop() is close to some value.

$.get('NewMoviesSub.aspx?c=' + (currentSet * 25).toString(), {
    curset: (currentSet * 25)
}, function(data) {
    var content = $(data).find('.movieTable');
    $("#MoviesDiv").append(content);
});​

I have stepped through all the other code and the content in $("#MoviesDiv") disappears when the .append is triggered in the code. As the get is asynchronous, the change of the content happens some time after the initial call to the function. So that is why I have even turned off the scroll function and I tried a button call to ensure that the function was called only once. But the content still disappeared.

This code is meant to help me continuously get more and more movies.

The new content found in ('.movieTable') is a table with more rows of movies. Whether I use .append or .appendTo I get the same results.

I have looked at other examples where .append didn't work for other people and I tried several of the solutions and none have helped me.

EDIT: The console will output the content now if you visit https://www.clearplay.com/NewMovies.aspx

1

There are 1 best solutions below

0
On

I was looking for another solution to another problem and I came across this: answer by Nick Berardi

His answer is to provide a way to fix IE 6 and 7 where when changing the DOM IE doesn't update. The fix is to cause the parent element to redraw. He suggests using the jQuery css display none and block. I tested it on my problem and it works beautifully to resolve the symptoms.

I would still like to have a true solution to this problem but as I can't spend more time on it I am making this post.

EDIT: This only works slightly. As long as you don't mouse over the posters they still show up, but it also takes a lot for the browser to redisplay the entire contents when you have scrolled some distance.