i have the following code in controller
public function actionTest($id)
{
$test=array(1,2,3);
print_r($test);
}
in index.php
<?php
$form = $this->beginWidget('CActiveForm', array(
'id' => 'job-form',
'enableAjaxValidation' => true,
));
echo CHtml::ajaxSubmitButton('Save', $this->createUrl('site/test', array('id' => 12)), array(
'type' => 'POST',
'dataType' => 'json',
'success' => 'function(data){
alert(data);
}',
));
$this->endWidget();
?>
but i can't get the alert to work and the array is not getting displayed..
if i comment the datatype it works fine...
public function actionTest($id)
{
$test=array(1,2,3);
print_r($test);
}
in index.php
<?php
$form = $this->beginWidget('CActiveForm', array(
'id' => 'job-form',
'enableAjaxValidation' => true,
));
echo CHtml::ajaxSubmitButton('Save', $this->createUrl('site/test', array('id' => 12)), array(
'type' => 'POST',
'dataType' => 'json',
'success' => 'function(data){
alert(data);
}',
));
$this->endWidget();
?>
but i can't get the alert to work and the array is not getting displayed..
if i comment the datatype it works fine...