In general, friends help there is such a code:

$(function(){$('.contactform1') .submit(function(){if($(this).validationEngine('validate')) {$(this).ajaxSubmit();gtag('event','request', {'event_category':'request','event_action':'request'}); $(this).clearForm();$ .arcticmodal('close'); `введите сюда код` $(".thanks").arcticmodal();}return false;});$.each($('.minconf span.textbtn'),function(index,val) {$(val).text($(val).closest('form') .find('button, input[type="submit"]').text());});$('.contactform_q') .submit(function(){if($(this).validationEngine('validate')) {$('.contactform_q input[name="quiz"]').val('вопрос1 '+q1+'. вопрос2: '+q2+'. вопрос3: '+q3+'. вопрос4: '+q4+'; вопрос5: '+q5+'.'+'Сумма: '+$('.fades7 .counternew').text());$(this).ajaxSubmit();gtag('event','request', {'event_category':'request','event_action':'request'}); $(this).clearForm();$.arcticmodal('close'); $(".thanks2").arcticmodal();}return false;});if(navigator.userAgent.match(/IEMobile\/10\.0/)){var msViewportStyle=document.createElement('style') msViewportStyle.appendChild(document.createTextNode('@-ms- viewport{width:auto!important}')) document.querySelector('head').appendChild(msViewportStyle)} var q1,q2,q3,q4,q5,q6; $(".callback_next").on("click",function(){$('.basic').fadeOut(0); $('.row .width').fadeOut(0); $('.nextblock').fadeIn(300);$('.fadesxs3').fadeIn(300);function printNumbersInterval(){var i=300;var timerId=setInterval(function() {var i2=i/10; $('.discount-total-count').text(i2.toFixed(1)+"%");if(i==0) {clearInterval(timerId);}i=i-1;function func(){$('.discount-total- count').removeClass('animated flash');}setTimeout(func,500);function func2(){$('.discount-total-count').addClass('animated flash');}setTimeout(func2,1000);},1000);}printNumbersInterval();}); $('.fades3 .answers label,.fades4 .answers label,.fades5 .answers label') .click(function(event){if($(this).find('.checkin').html()=='') {$(this) .find('.checkin').html('<i class="fa fa-check">');}else{$(this) .find('.checkin').html('');}$(this).closest('.block') .find('button.mybtn_white').fadeIn(300).addClass('blockbtn');}); $('.fades2 .answers label,.fades6 .answers label') .click(function(event){if($(this) .find('.checkin').html()==''){$(this).closest('.answers') .find('.checkin').html('');$(this) .find('.checkin').html('<i class="fa fa- check">');}else{$(this) .find('.checkin').html('');$(this).closest('.block') .find('button.mybtn_white').fadeOut(300).removeClass('blockbtn');} $(this).clo sest('.block') .find('button.mybtn_white').fadeIn(300).addClass('blockbtn');});var f1,f2,f3,f4;f2=0;f3=0;f4=0;$(".nexts2").on("click",function() {$('.fades2').fadeOut(0);$('.fades3').fadeIn(300);q1=$('.fades2') .find('i.fa.fa-check').closest('.div').data('s'); $('input[name=step1]').val(q1);}); $(".nexts3").on("click",function(){$('.fades3').fadeOut(0); $('.fades4').fadeIn(300);$.each($('.fades3 i.fa.fa- check'),function(index,val){q2=$(val).closest('.div').data('s')+'. '+q2;}); q2=q2.split('undefined');q2=q2[0]; $('input[name=step2]').val(q2);}); $(".nexts4").on("click",function(){$('.fades4').fadeOut(0); $('.fades5').fadeIn(300);$.each($('.fades4 i.fa.fa- check'),function(index,val){q3=$(val).closest('.div').data('s')+'. '+q3;}); q3=q3.split('undefined');q3=q3[0]; $('input[name=step3]').val(q3);}); $(".nexts5").on("click",function(){$('.fades5').fadeOut(0); $('.fades6').fadeIn(300);$.each($('.fades5 i.fa.fa- check'),function(index,val){q4=$(val).closest('.div').data('s')+'. '+q4;}); q4=q4.split('undefined');q4=q4[0]; $('input[name=step4]').val(q4);});var summas; $(".nexts6").on("click",function(){$('.fades6').fadeOut(0); $('.fadesxs3').fadeOut(0);$('.fades7').fadeIn(300); $('.fades7 .counternew').text($('.discount-total-count').text()); q5=$('.fades6') .find('i.fa.fa-check').closest('.div').data('s'); $('input[name=step5]').val(q5); $('input[name=discount]').val($('.discount-total- count').text());});}); 

he writes the answers to the questions in <input name=step>
How to make it not transmit these answers to input and pass them on to index2.php ?

    1 answer 1

    First we take the values ​​from <input id="step"> into the variable

     var value_step = document.getElementById('step').value; 

    To transfer data by post using AJAX, make sure that you send the correct header for example

     httpRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 

    Then we transfer this value to the server like this.

     httpRequest.send('value_step='+value_step); // передаем данные на сервер 

    Where 'value_step' will be the key to get on the server side.

    Those. on server you accept $_POST['value_step']; //здесь будет переданное значение $_POST['value_step']; //здесь будет переданное значение