Commit 4e2ac8b5 authored by Shakarim Sapa's avatar Shakarim Sapa

- Fix

parent 54b15339
<?php
/**
* Created by PhpStorm.
* User: PHOENIX
* Date: 25.04.16
* Time: 21:01
*/
namespace common\modules\blog\controllers;
......
......@@ -56,16 +56,6 @@ if ($cacheEmail!==false && BlogBids::find()->where(['email' => $cacheEmail])->ex
$('form.blog-bid-form').on('beforeSubmit', function(e) {
var form = $(this), xhr = new XMLHttpRequest, filebool = false, file, data = new FormData();
form.find('input, textarea').each(function(){
data.append($(this).attr('name'), $(this).val());
});
if(form.find('input[type=file]').length) {
file = form.find('input[type=file]')[0].files[0];
filebool = !filebool;
data.append("Bid[file]", file);
}
xhr.open("POST", form.attr('action'), true);
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
......@@ -84,7 +74,6 @@ if ($cacheEmail!==false && BlogBids::find()->where(['email' => $cacheEmail])->ex
if(response.success) {
if(form.find('.message-box.send_secce').length > 0) {
console.log('asd');
form.find('.message-box.send_secce').fadeIn('fast');
form.find('.content').css('visibility','hidden');
......@@ -110,14 +99,15 @@ if ($cacheEmail!==false && BlogBids::find()->where(['email' => $cacheEmail])->ex
form.parent('div').fadeOut(500);
}, 1600);
}
else
{
else {
var errors = [];
$.each(response, function(key, value) {
form.find('.field-'+key).addClass('has-error');
errors = errors.concat(value);
});
console.log(errors);
if(form.find('.message-box.send_err').length > 0)
{
form.find('.message-box.send_err').fadeIn('fast');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment