Документы

Быстрый заказ

window.onload = function() { var doc_type = "fast_zakaz"; if(doc_type){ $.ajax({ url: 'index.php?route=product/quick_bay/get_document_from', type: 'post', data: 'doc_type='+doc_type, dataType: 'html', success: function(html_data) { $(".form_box").html(html_data); }, error: function(xhr, ajaxOptions, thrownError) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); } }; $(document).on("click","#send_quick_bay",function(){ $.ajax({ url: 'index.php?route=module/bigdes/bigdes_one_click/add', type: 'post', data: $('#one_click_order_form input[type=\'text\'], #one_click_order_form input[type=\'hidden\'], #one_click_order_form input[type=\'radio\']:checked, #one_click_order_form input[type=\'checkbox\']:checked, #one_click_order_form select, #one_click_order_form textarea'), dataType: 'json', beforeSend: function() { $('#button-oneclick').button('loading'); }, complete: function() { $('#button-oneclick').button('reset'); }, success: function(json) { console.log(json); $('.callback_danger_messages').remove(); $('.text-danger').remove(); $('.form-group').removeClass('has-error'); $('.input-group').removeClass('has-error'); if (json['error']){ if (json['error']['one_click_phone_my']) { $("#one_click_order_form input[name=\'phone\']").parent().addClass('has-error').after('
'+json['error']['one_click_phone_my']+'
'); } console.log(json['error']['one_click_phone_my']); if (json['error']['unknown']) { alert(json['error']['unknown']); } if (json['error']['one_click_name']) { $("#one_click_order_form input[name=\'one_click_name\']").parent().addClass('has-error').after('
'+json['error']['one_click_name']+'
'); } if (json['error']['one_click_phone']) { $("#one_click_order_form input[name=\'one_click_phone\']").parent().addClass('has-error').after('
'+json['error']['one_click_phone']+'
'); } if (json['error']['one_click_email']) { $("#one_click_order_form input[name=\'one_click_email\']").parent().addClass('has-error').after('
'+json['error']['one_click_email']+'
'); } if (json['error']['one_click_comments']) { $("#one_click_order_form textarea[name=\'one_click_comments\']").parent().addClass('has-error').after('
'+json['error']['one_click_comments']+'
'); } if (json['error']['option']) { for (i in json['error']['option']) { var element = $('#input-option_one' + i.replace('_', '-')); if (element.parent().hasClass('input-group')){element.parent().after('
' + json['error']['option'][i] + '
');} else {element.after('
' + json['error']['option'][i] + '
');} } } if (json['error']['recurring']) {$('select[name=\'recurring_id\']').after('
' + json['error']['recurring'] + '
');} $('.text-danger').parent().addClass('has-error'); } if (json['success']) { $('#one_click_order').modal('hide'); $('#one_click_order').on('hidden.bs.modal', function(e){ $('#one_click_order').remove(); }); $("#one_click_order_form .col-md-8").html(json['success']); } }, error: function(xhr, ajaxOptions, thrownError) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); });