Hello everyone.
i have problem in CHtml::ajaxLink.
<?php if($job_status[0]->job_status=="Created" || $job_status[0]->job_status=="Quoted")
{
echo "hii";
echo CHtml::ajaxLink('<i class=\'hi hi-play fa-2x icon-vertical-padding\'></i></br><small>Start</small>',
Yii::app()->createUrl('/jobMaster/StartJob',array('id'=>$value->id)),
array(
'dataType'=>'html',
'success'=>'function(data){
var obj=$.parseJSON(data);
if(obj.option=="start" && obj.status=="yes")
{
alert("Job Successfully Started.");
//$("#jobBox'.$i.'").load(location.href+" #jobBox'.$i.'>*","");
$("#AllJobs").load(location.href+" #AllJobs>*","");
}}',
),array('class'=>'col-md-4 col-xs-4 text-center text-warning')
);
}if($job_status[0]->job_status=="Started")
{
echo "hello";
echo CHtml::ajaxLink('<i class=\'hi hi-check fa-2x icon-vertical-padding\'></i></br><small>Complete</small>',
Yii::app()->createUrl('/jobMaster/CompleteJob',array('id'=>$value->id)),
array(
'dataType'=>'html',
'success'=>'function(data){
var obj=$.parseJSON(data);
if(data.option=="complete" && data.status=="yes")
{
alert("Job Successfully Completed.");
$("#AllJobs").load(location.href+" #AllJobs>*","");
}}',
),array('class'=>'col-md-4 col-xs-4 text-center text-success')
);
}
?>
In this code. when i click on start it works perfectly and call right action. and update the div with changed status and link. but when i click on complete link it also called "startjob link". it have to call "completejob" link.
But when i refresh whole page and click on complete it call right action "completejob".
What is Problem???