I'm building one ajax paginator. Cosider the following conditions:

Common snippert:

$(document).ready( function(){

var opts = { url : '/vstock/query',
         target : '#id-vstock-query-result',
         success : paginator_hook
        };
var form_id = '#id-vstock-query-form';
$(form_id).ajaxForm(opts);
$(form_id).ajaxSubmit(opts);

<<< Difference >>>

});

It works in Firefox and Opera, failed in IE, when <<<difference>> is:

function paginator_hook(){
    $('div.paginator a.ajaxpage').click( function(e){
        $.ajax(
            {
                url : $(this).attr('href'),
                type : 'GET',
                success : function(data){ $
(this).parents('div.paginator').html(data); paginator_hook(); }
            });
        return false;
    });
};

and when <<<difference>>> is :

function paginator_hook(){
    $('div.paginator a.ajaxpage').click( function(e){
        $.get($(e.target).attr('href'), function(data) { $
(e.target).parents('div.paginator').html(data); paginator_hook(); });
        return false;
    });
};

To make it work in IE, I have to replaced "e.target" with the id
"#next-page" in $(e.target).parents(...) like this:

function paginator_hook(){
    $('div.paginator a.ajaxpage').click( function(e){
        $.get($(e.target).attr('href'), function(data) { $('#next-
page').parents('div.paginator').html(data); paginator_hook(); });
        return false;
    });
};

So what's going wrong with the $(e.target) selector? How can I make it
work with the event obj but not the id?

Best regards!
can

Reply via email to