1

I am trying following.

Yii::app()->clientScript->registerScript('register_script_name', "
    $('.text-warning').click(function(){

        var id = $(this).attr('value');
        alert(id);
        $.ajax({
                    type:'POST',
                    url:'/jobMaster/test'/id/'+id,
                    success:function(ajaxresponse){ 

                               },
                    error:function(ajaxresponse){ 

                                      });
                              },

                                    });
       return false;
    });
");

But my ajax url " url:'/jobMaster/test'/id/'+id," doesn't called.If i don't use ajax it works. what is wrong?

1
  • u can use EOD ... to make it more simpler...!!! Commented Dec 23, 2014 at 9:59

2 Answers 2

1

Actually Your code is worng, try like this -

Yii::app()->clientScript->registerScript('register_script_name', "
    $('.text-warning').click(function(){

        var id = $this.value;
        alert(id);
        $.ajax({
                type:'POST',
                url:'".Yii::app()->createAbsoluteUrl('jobMaster/test')."',
                data:'id='+id
                success:function(response){ 

                        },
               error:function(er){ 

                   }
           });
       return false;
    });
");
Sign up to request clarification or add additional context in comments.

Comments

0

url:'/jobMaster/test'/id/'+id,

here you've messed with '

probably you need to do it this way:

url:'/jobMaster/test/id/'+id,

Also, check the bracket levels.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.