带有jquery的AJAX上的Javascript

-

how can I handle it, to get Javascript is working after the Ajax call?

On my page (wordpress) - I have all posts on startpage. I have built in a filtersystem with which the user can filter the posts after specific stuff - like "newest, most viewed, highlighted"

I use this function beneath to make this filter work:

 <script type="text/javascript">
    $(document).ready(function(){
    $.ajaxSetup({cache:false});
    $("#new").click(function(){

        var post_id = $(this).attr("rel")
        $(".postbox_wrapper").html('<span class="filter_posts">
<img src="<?php bloginfo ('template_directory'); ?>/images/287.gif"></span>');
        $(".postbox_wrapper").load(jQuery(this).attr("href") + " .postbox_wrapper")
        return false;
    });
});

The visitior clicks on the button "new" and the posts are filtered - only the newest posts show up. But I use Javascript to have the post count of disqus, lazy image loader, etc. these JS Files are not loaded on the filtered posts. (taxonomy.php)

this here is e.g. an JS File, which would be neccessary to make lazy loader available to the filtered posts:

http://myurl/../plugins/bj-lazy-load/js/bjll.min.js?ver=0.4.0

The question is: How can I tell in the function above, to also use the JS script on the new loaded "filtered" page.

It's a bit like this: Use Ajax() function in Jquery to load PART of an external page into div

but I didn't get it to work....

thanks a lot!

查看全部
weixin_33749242
weixin_33749242
2012/07/21 13:03
  • ajax
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

1个回复