Yii Framework Forum: CHtml::ajaxLink Call pervious url - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CHtml::ajaxLink Call pervious url Rate Topic: -----

#1 User is offline   Dhara 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 26-April 14
  • Location:India

Posted 25 November 2014 - 01:26 AM

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??? :(
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users