How to use ajax in Yii::app()->clientScript->registerScript

Hello,

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;

    });

");



my ajax url " url:’/jobMaster/test’/id/’+id," doesn’t called. what is wrong?


Yii::app()->clientScript->registerScript('register_script_name', "

    $('.text-warning').click(function(){

       

        var id = $(this).attr('value');

        alert(id);

        $.ajax({

                    type:'GET',

                    data: { id: id} ,

                    url:'". $this->createUrl("jobMaster/test") . "',

                    success:function(ajaxresponse){ 

                                                                

                               },

                    error:function(ajaxresponse){ 

                                                      

                                      });

                              },

                                              

                                    });

       return false;

    });

");


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;

    });

");

this would do it


<?php

Yii::app()->clientScript->registerScript('register_script_name', "

	$('.text-warning').click(function(e){

		$.ajax({

			type: 'POST',

			url: '/jobMaster/test',

			data: {id: $(this).attr('value')},

			success: function(res){},

			error: function(res){}

		});

		return false;

	});

");

?>