2015-09-18 16:13:39 2349次浏览 2条回答 1 悬赏 10 金钱
<script>
    var text = "<?= Yii::$app->urlManager->createUrl('user/change')?>";
</script>
<?php
$js=<<<PAGEJS
$(function(){
    $("input[type='radio']").click(function(){
        var title = $(this).prop('title');
        $.ajax({
                type:'POST',
                url :text+'&id='+title,
                data:{id:title},
                success:function(data){
                alert(data);
                    if(data >0){
                        window.location.reload();
                    }else{
                         window.location.reload();
                    }
                }
            });

    });
});

PAGEJS;
$this->registerJs($js, $this::POS_END, 'user/index');
?>
  • 回答于 2015-09-18 17:21 举报

    你使用了PJAX了吗?这个情况我前面遇到过,你把 $("input[type='radio']").click(function()改为$(document).on("click","input[type='radio']",function()就可以了。

    1 条回复
    回复于 2015-09-21 10:22 回复

    嗯 我已经解决了 换了个视图控件

  • 回答于 2015-09-18 17:48 举报

    试试
    $this->registerJs($js, $this::POS_BEGIN, 'user/index');

    1 条回复
    回复于 2015-09-21 10:22 回复

    谢谢

您需要登录后才可以回答。登录 | 立即注册
tangyuan
主管

tangyuan 上海

注册时间:2015-09-01
最后登录:2016-06-28
在线时长:18小时31分
  • 粉丝2
  • 金钱590
  • 威望10
  • 积分870

热门问题