Wednesday, 30 October 2013

Ajax request in Yii Framework

Here is the code

In View
$.post('<?php echo Yii::app()->createAbsoluteUrl('controller_name/action_name);?>',{variable_name_in_action :variable_value},function(data)
if(data=='')
                 {
 //do this
}
else{

//do this
}

In Controller

public static function actionAction_name()
{
//you can get varible value here
$variable_name_in_action            =    $_POST['variable_value'];

}



No comments:

Post a Comment