$('.action-update').click(function (e) {
var title = $(this).data('title')
var link = $(this).val()
$.alert({
title: title,
content: 'url:' + link,
columnClass: 'col-6',
containerFluid: true,
buttons: {
saveButton: {
text: 'Сохранить',
btnClass: 'btn-green',
action: function () {
var formData = new FormData($('form')[0]);
$.ajax({
url: link,
method: 'post',
data: formData,
contentType: false,
cache: false,
processData:false,
success: function (data) {
console.log(data)
}
})
}
},
closeButton: {
text: 'Закрыть'
}
}
})
});
if ($model->load(Yii::$app->request->post()) && $model->save()) {
if (UploadedFile::getInstance($model, 'image')) {
$model->uploadImage();
}
return !$model->hasErrors() ? $this->asJson(['status' => true]) : $this->asJson(['status' => false, 'message' => $model->getErrors()]);
}