this should help:

http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_AJAX_request.3F

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Jul 5, 2009, at 8:10 PM, misiek wrote:


Hello,

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&amp;photo=1";>Previous Photo</a></div>
<div class="next nawi"><a
href="http://page.com?album=1&amp;photo=9";>Next Photo</a></div>
</div>
<div class="blablabla">
[...]
</div>
</div>

js:

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


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