On 6 Lip, 14:17, Karl Swedberg <k...@englishrules.com> wrote:
> this should help:
>
> http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st...
>
> --Karl

Thank you!

I have mentioned that I have already tried something like this:
JS:

$().ready(function (){
  $("div.nawi a").each( function(i) {
    $(this).unbind("click");
    $(this).bind("click", function(e){
      var tmp = $(this).attr("href");
      var search_wynik_zapytania = tmp.search(/\?/);
      var wynik_url = tmp.substring(0,search_wynik_zapytania);
      var wynik_data = tmp.substring(search_wynik_zapytania
+1,tmp.length);
      e.preventDefault();
      $.ajax({
                url: wynik_url,
                data: wynik_data + '&ajax=1',
                type: 'GET',
                success: function(results) {
                    $("div.ajax_here").html(results);
            $("div.nawi a").each( function(i) {
            $(this).unbind("click");
            $(this).bind("click", function(e){
              var tmp = $(this).attr("href");
              var search_wynik_zapytania = tmp.search(/\?/);
              var wynik_url = tmp.substring(0,search_wynik_zapytania);
              var wynik_data = tmp.substring(search_wynik_zapytania
+1,tmp.length);
              e.preventDefault();
              $.ajax({
                        url: wynik_url,
                        data: wynik_data + '&ajax=1',
                        type: 'GET',
                        success: function(results) {
                            $("div.ajax_here").html(results);
                        }
                });
            });
          });
                }
        });
    });
  });
});

I have added almost the same code to Ajax "success" property, but is
works only two times in row. With third image (after second Ajax
request, it doesn't work). So my question is, how to propagate this
bind to every next ajax's requests? I know that I can copy this code
again and again, but this solution would be very weird and limited...


[...]
>
> > My code:
>
> > html:
>
> > <div class="ajax_here">
> > <div class="breadcrumb">
> > <a href="http://page.com"; class="backlink">Albums</a> » <a
> > href="http://page.com?album=1"; class="backlink">Album 1</a> »  
> > cxzcc.jpg
> > </div>
> > <div class="prevnext">
> > <div class="prev nawi"><a
> > href="http://page.com?album=1&photo=1";>Previous Photo</a></div>
> > <div class="next nawi"><a
> > href="http://page.com?album=1&photo=9";>Next Photo</a></div>
> > </div>
> > <div class="blablabla">
> > [...]
> > </div>
> > </div>
>
> > js:
>
[...]
>
> > Question: could you tell my how to reload binds for events? I mean how
> > to add binds to <a> which is/are returned from Ajax request.
> > I have already tried with $("div.nawi a").change,load ,but without
> > positive results.
>
> > __________ Information from ESET NOD32 Antivirus, version of virus  
> > signature database 4219 (20090705) __________
>
> > The message was checked by ESET NOD32 Antivirus.
>
> >http://www.eset.com

Reply via email to