Javascript 如何使用回调和使用x-editable(如yii扩展)
我尝试使用回调。如果数据更新成功,那么我需要显示模式窗口。但它不起作用!救命啊!我不知道它是怎么工作的。请给我写信 鉴于Javascript 如何使用回调和使用x-editable(如yii扩展),javascript,php,jquery,ajax,yii,Javascript,Php,Jquery,Ajax,Yii,我尝试使用回调。如果数据更新成功,那么我需要显示模式窗口。但它不起作用!救命啊!我不知道它是怎么工作的。请给我写信 鉴于 <?php $this->widget('editable.EditableField', array( 'type' => 'select', 'params' => array('YII_CSRF_TOKEN' => Yii::app()->request->csrfToken), 'model'
<?php
$this->widget('editable.EditableField', array(
'type' => 'select',
'params' => array('YII_CSRF_TOKEN' => Yii::app()->request->csrfToken),
'model' => $model,
'attribute' => 'category_id',
'url' => $this->createUrl('course/updateSameInfo'),
'source' => Editable::source(Coursecat::model()->findAll(), 'id', 'name'),
'placement' => 'right',
));
?>
使用success属性。这是文件
试试这个
<?php
$this->widget('editable.EditableField', array(
'type' => 'select',
'params' => array('YII_CSRF_TOKEN' => Yii::app()->request->csrfToken),
'model' => $model,
'attribute' => 'category_id',
'url' => $this->createUrl('course/updateSameInfo'),
'source' => Editable::source(Coursecat::model()->findAll(), 'id', 'name'),
'placement' => 'right',
'success' => 'js: function(response, newValue) {
console.log(response); //Open the browser console to check the data
}'
));
?>
您得到的错误是什么?
<?php
$this->widget('editable.EditableField', array(
'type' => 'select',
'params' => array('YII_CSRF_TOKEN' => Yii::app()->request->csrfToken),
'model' => $model,
'attribute' => 'category_id',
'url' => $this->createUrl('course/updateSameInfo'),
'source' => Editable::source(Coursecat::model()->findAll(), 'id', 'name'),
'placement' => 'right',
'success' => 'js: function(response, newValue) {
console.log(response); //Open the browser console to check the data
}'
));
?>