I have an Ajax Issue…
Here’s the index…
//.......
<div class="container">
<div class="row">
<div class="span12" id="wsView" style="margin: 0 auto; width:100%; text-align: center;">
<?php
if($dayOffset == 0){
$this->renderPartial('_interval', array(
'prev' => $prev,
'next' => $next,
'dayOffset' => $dayOffset
),false,true);
}
?>
</div>
/.......
Heres the action…
function actionPrevWeek()
{
if (Yii::app()->request->isAjaxRequest) {
echo "loaded action PrevWeek-".rand();
//To prevent loading files each request
Yii::app()->clientScript->scriptMap = array("jquery.js" => false,
'bootstrap.min.js'=> false);
$this->count--;
// echo "<br>$this->count<br>";
$currDay = myDateUtil::getDateInterval($this->count);
var_dump($currDay);
$dates = myDateUtil::getWeeklyInterval(TRUE, $currDay);
$prev = $dates[0]->format("Y/m/d");
$next = $dates[1]->format("Y/m/d");
$this->renderPartial('_interval',
array(
'prev' => $prev,
'next' => $next,
'dayOffset' => $this->count
), false, true);
}
}
and finally heres the view…
print_r($this->currDay);
echo "<br>";
echo "Offset=" . $dayOffset . "<br>";
$today = new DateTime();
$currDay = myDateUtil::getDateInterval($dayOffset);
var_dump($currDay);
echo "<br>" . $dayOffset . "<br>";
//HERE LIES THE AJAX CODE
echo CHtml::ajaxLink('Prev', array('PrevWeek'), array('replace' => '#wsView'),array('id' => 'send-link-' . uniqid()));
//echo CHtml::ajaxLink('Prev', $pUrl, array('update' => '#wsView'))
?>
<?php echo " " . $prev; ?> - <?php echo " " . $next . " ";
echo CHtml::ajaxLink('Next', array('NextWeek'), array('replace' => '#wsView'),array('id' => 'send-link-' . uniqid()));
the problem is that the page only refreshes the div the first time anytime after that, I can see the requests in firebug, but the div is not refreshed, and in fact the action isn’t even called