【问题标题】:yii ajaxLink success and replaceWithyii ajaxLink 成功和replaceWith
【发布时间】:2014-02-10 03:30:13
【问题描述】:

三个小时以来,我没有在 jquery 中发现错误。 创建文件后,我尝试刷新 div

这是我的观点

<?php
echo CHtml::ajaxLink('Neuen Export erstellen',
    Yii::app()->createUrl('exporter/create' ),
    array(
        'data' => array(),
        'dataType'  => 'json',
        'type'      => 'POST',

        'complete'  => "js:function(html){
            $('#export-grid').fadeOut().fadeIn();
        }",

        'success'   => "js:function(html){
            $('#export-grid').replaceWith();
        }"

    ),
    array(
        'class' => 'c2a_gray alignright',
        'style' => 'font-size: 12px',
    )
);
?>

** 我的控制器**

public function actionCreate()
{
    // createfile();...
    // do some stuff
    $this->renderPartial('//users//exporter//_tmo', true, true);
}

complete 选项在 ajaxLink 函数中效果很好 但如果我把 alert(html) 放在 complete 我得到“对象对象”

我不知道如何用新内容更新 export-grid。

请帮助我! 谢谢!

【问题讨论】:

    标签: javascript php jquery yii


    【解决方案1】:

    是的,如果您尝试警告 html,那么它将返回 Object。 请尝试alert(html.responseText)

    【讨论】:

    • 完美!非常感谢!
    猜你喜欢
    • 2012-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多