最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to reload script after ajax call? - Stack Overflow

programmeradmin3浏览0评论

I'm using infinite scroll and social share buttons after loading more results aren't appearing. I need to reload the script for the buttons to appear? I'm using the add to any plugin and they script is <script type="text/javascript" src=".js"> </script> How do i reload this script so that the buttons appear? I added this code but only the facebook and twitter buttons appeared after ajax loaded new results not the google plus and pinterest...

jQuery('body').trigger( 'post-load');

How do i solve this?

I'm using infinite scroll and social share buttons after loading more results aren't appearing. I need to reload the script for the buttons to appear? I'm using the add to any plugin and they script is <script type="text/javascript" src="http://static.addtoany./menu/page.js"> </script> How do i reload this script so that the buttons appear? I added this code but only the facebook and twitter buttons appeared after ajax loaded new results not the google plus and pinterest...

jQuery('body').trigger( 'post-load');

How do i solve this?

Share Improve this question asked Feb 19, 2015 at 11:40 user892134user892134 3,21419 gold badges68 silver badges140 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

You can use the .ajaxComplete(function().

$( document ).ajaxComplete(function() {
  $( ".log" ).text( "Triggered ajaxComplete handler." );
});

See more here.

Or you can use the jQuery.GetScript()

$.getScript( "ajax/test.js" )
  .done(function( script, textStatus ) {
    console.log( textStatus );
  })
  .fail(function( jqxhr, settings, exception ) {
    $( "div.log" ).text( "Triggered ajaxError handler." );
});

See more here.

$( document ).ajaxComplete(function() {
 a2a.dom.ready(function(){a2a.init_all();a()});
});

or

 $( document ).ajaxComplete(function() {
    if(document.body){a2a.init();a()} a2a.dom.ready(function(){a2a.init_all();a()});
 });
发布评论

评论列表(0)

  1. 暂无评论