Valeriy
Valeriy

Reputation: 31

Why does not Opera 9.6 work with Jquery context selector in my code

please help The jQuery Code:

jQuery.ajax({url:nextPortionLink,
             success: function(data) {
               nextPortion = jQuery("#productList", data).html();
             }});

Variable data has html page with #productList, .productImage, a, img...

But any of these selectors doesn't work here. Why?

jQuery(data).find("anything") doesn't work either

nextPortion == null for Opera 9.6

This code works fine with IE7,8 FF3-4 but not in Opera 9.6 and IE9

Upvotes: 3

Views: 393

Answers (1)

ezmilhouse
ezmilhouse

Reputation: 9131

check jQuery's dataType, should be "html":

jQuery.ajax({
    url:nextPortionLink,
    dataType: "html",
    success: function(data) {
        nextPortion = jQuery("#productList", data).html();
    }
});

you must be sure that your jQuery obj is of dataType 'html', if not (OP will return null) you can force it to be 'html' using:

var data = jQuery(data).html();

find working example here: http://jsfiddle.net/aA3VN/1/

Upvotes: 1

Related Questions