E
E
EVOSandru62015-10-21 14:12:53
JavaScript
EVOSandru6, 2015-10-21 14:12:53

How to change the value and url of ajax itself in ajaxSubmitButton?

echo CHtml::ajaxSubmitButton
(
    $model->isNewRecord ? 'Добавить номера' : 'Обновить',

    Yii::app()->createUrl('sadmin/hotels/ajaxCreate'),
    [
        'type'=>'POST',
        'data'=>'js:$("#hotels-form").serialize()',
        'success'=>'js:function(data)
        {
            $("#crud-hotel").empty();
            $("#crud-hotel").append(data);
            setLocation("update/id/'.$model->id.'");
        }',
    ],
    [
        'id'=>'add-hotel',
        'class'=>'btn btn-primary btn-lg center-block',
    ]


Adding to success does not fix the situation : You also need to replace: Yii::app()->createUrl('sadmin/hotels/ajaxCreate' ) with another url , how can this be done?

$("#add-hotel").value("Новое значение");


Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2015-10-21
@R0dger

Yii::app()->createUrl('sadmin/hotels/'. $model->isNewRecord ? 'ajaxCreate' : 'ajaxUpdate'),

and if so? Or what do you want to achieve?
usually after creation, they immediately redirect to editing and that's it ...
you can organize it on Angular ... the only question is why ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question