douchunxian9740
douchunxian9740
2016-12-15 08:07
浏览 44

Javascript函数datepicker,ajax调用后lazyload无法正常工作

I know we had to initialize javascript functions after the ajax call in success, but that too doesnt work in my case. Following is my code :

jQuery :

$.ajax({
            type:'POST',
            url:ajaxurl,
            data:{
                action:'get_more_posts',
            },
            success:function(data){
                 console.log(data);
                 $('#posts-inner-container').append(data); // data includes datepicker textbox
                 $('.datepicker').datepicker();
            }
        });
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dqsong2010
    dqsong2010 2016-12-15 09:23
    已采纳

    Initialize datepicker all over the site. Use following code :

    $.ajax({
            type:'POST',
            url:ajaxurl,
            data:{
                action:'get_more_posts',
            },
            success:function(data){
                 console.log(data);
                 $('#posts-inner-container').append(data); // data includes datepicker textbox
                 $(document).find('.datepicker').datepicker();
            }
        });
    
    点赞 评论

相关推荐