Skip to content

Instantly share code, notes, and snippets.

@amarynets
Created December 15, 2016 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amarynets/f6a78e2e98cfbbeec049fc786ebefb46 to your computer and use it in GitHub Desktop.
Save amarynets/f6a78e2e98cfbbeec049fc786ebefb46 to your computer and use it in GitHub Desktop.
submitHandler: function submitHandler(form, event) {
var values = {
toggler: $('#toggly').val(),
step1Unchecked: {
step1FirstRoofDeg: document.getElementById('range_1').noUiSlider.get(),
step1FirstRoofOrientation: $('#orientation-1').val(),
step1SecondRoofDeg: document.getElementById('range_2').noUiSlider.get(),
step1SecondRoofOrientation: $('#orientation-2').val(),
step1ResultCalculatorSquereMeters: $('#result_calculator').val()
},
step1Checked: {
step1CHECKEDFirstRoofKwp: $('#kwp-1').val(),
step1CHECKEDFirstRoofOrientation: $('#orientation-3').val(),
step1CHECKEDFirstRoofDeg: document.getElementById('range_3').noUiSlider.get(),
step1CHECKEDSecondRoofKwp: $('#kwp-2').val(),
step1CHECKEDSecondRoofOrientation: $('#orientation-4').val(),
step1CHECKEDSecondRoofDeg: document.getElementById('range_4').noUiSlider.get()
},
step2CountPeoples: document.getElementById('range_5').noUiSlider.get(),
step3CountkWh: $('#fieldset-kwh').val(),
step4KwhPrice: document.getElementById('range_6').noUiSlider.get(),
step4ActualSupplier: $('#actual-supplier').val(),
newlatters: $('#chk-newslatters-1').val(),
csrfmiddlewaretoken: valid.getCookie('csrftoken')
};
var data = $.extend({}, values, result);
console.log(data);
$.ajax({
method: "post",
url: "/configurator/",
cache: false,
data: data,
success: function success() {
console.log('changed :]');
},
complete: function complete() {
$('.cd-overlay').click();
setTimeout(function () {
$('#step-5-next').click();
}, 1100);
},
beforeSend: function beforeSend() {}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment