Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将参数附加到createUrl()Yii_Php_Jquery_Ajax_Yii - Fatal编程技术网

Php 将参数附加到createUrl()Yii

Php 将参数附加到createUrl()Yii,php,jquery,ajax,yii,Php,Jquery,Ajax,Yii,我尝试用jQuery在yii1中编写ajax请求。在我的URL中,我尝试附加链接的id属性值,但我不能这样做。这是我的密码: Yii::app()->clientScript->registerScript('vot', " $(document).ready(function(){ $('.js-register-member').click(function(e){ e.preventDefault(); $.ajax({

我尝试用jQuery在yii1中编写ajax请求。在我的URL中,我尝试附加链接的id属性值,但我不能这样做。这是我的密码:

Yii::app()->clientScript->registerScript('vot', "
$(document).ready(function(){
    $('.js-register-member').click(function(e){
        e.preventDefault();
        $.ajax({
            method: 'POST',
            url: '" . $this->createUrl('cre/register/124'). "',
        });
    });
});
); 我需要把我的参数放在124的位置。。。我试着放一些东西,比如:

$(this).attr('id'); but I get  500 error

试试这个。希望它能起作用

Yii::app()->clientScript->registerScript('vot', "
    $(document).ready(function(){
        $('.js-register-member').click(function(e){
            e.preventDefault();
            var id = $(this).attr('id');
            $.ajax({
                method: 'POST',
                url: '" . $this->createUrl('cre/register/') . "'  + id ,
            });
        });
    });
");

你试过这样吗$this->createUrl'cre/register/$this.attr'id\';',嗯…当我转到第二页gridView时我没有工作。。。所有脚本都存在,但默认不起作用,请求不发送。。。