开发者

ajax jquery selector not working in ie6-8

I tried posting the problem I had earlier, but I did not fully understand the problem and I had other issues that I confused to be part of this, so I deleted the post. Now that I solved the other problems and pinpointed the problem, here it is...

I'm trying to ajax load some elements from another page and it works in FF3.5+, Chrome 8+, Safari 3+, Opera 9.5+, and IE9.

I was tr开发者_如何学编程ying to fix it on IE7 and found that it will only load the whole page and not just certain elements using selectors.

The code:

    navigation.children('a').click(function() {
        if(pageNum <= max) {
            $(this)
                .css({display: 'none'})
                .after(loading)
                .blur();

            $('<div />')
                .load(nextLink + ' .post', function() {
                    pageNum++;
                    nextLink = nextLink.replace(/\/page\/[0-9]?/, '/page/'+ pageNum);

                    if(pageNum <= max) {
                        navigation.children('a').css({display: 'inline'});
                        loading.remove();
                    }
                    else {
                        navigation.html('');
                    }

                    navigation.before($(this).html());
                })
                .ajaxComplete(function() {
                    if (pageNum > max) {
                        navigation.remove();
                    }
                });
        }
        return false;
    });

If I change .load(nextLink + ' .post', function() to .load(nextLink, function(), it will work in IE7, but will display all the other stuff I didn't want.

Link to the problem: http://gavsiu.com/portfolio/


are yousure nextLink is a string. Can you just cast it to a string and then try concatenating something like

String(nextString) + ".class"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜