首页 > 在yii2中使用pjax时,无法加载验证表单js文件?

在yii2中使用pjax时,无法加载验证表单js文件?

比如我用ajax请求一个验证表单。

$('#setpw-tab').on('click',function(){
        $.ajax({
            url:"index.php?r=user/recovery/setnewpw",
            type:"post",
            success:function(data){ 
                $('#setpw').html(data); 
                
                }
         });
       });

yii2验证表单的js也一起加载进来,使用正常。
但是当我用pjax时,

$(document).pjax('#setpw','#containerp',{url:'index.php?r=user/recovery/setnewpw',type:'POST'})

却没能加载ActiveForm的js,请求是一样的,却少了2个js文件,为什么呢?


你可以参考看下这个:https://github.com/defunkt/jquery-pjax/issues/331#issuecomment-54364324

【热门文章】
【热门文章】