88 lines
2.1 KiB
JavaScript
88 lines
2.1 KiB
JavaScript
function sendRoute(el){
|
|
event.preventDefault()
|
|
let form = el.form;
|
|
let formData = new FormData(form);
|
|
|
|
$.ajax({
|
|
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
|
url: '/ru/routes/create_route/',
|
|
type: "POST",
|
|
// async: true,
|
|
cache: false,
|
|
processData: false,
|
|
contentType: false,
|
|
// enctype: 'json',
|
|
data: formData,
|
|
success: function(data){
|
|
console.log('data received')
|
|
// location.href = '/profile'
|
|
document.querySelector(".info_profile").innerHTML = data.html
|
|
|
|
|
|
},
|
|
error: function (data, exception){
|
|
document.querySelector(".info_profile").innerHTML = data.responseJSON.html;
|
|
|
|
|
|
|
|
$('#id_weight').ionRangeSlider({
|
|
skin: "round",
|
|
type: "single",
|
|
min: 0,
|
|
max: 1000,
|
|
step: 1,
|
|
grid: true,
|
|
grid_num: 5,
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
//cleaning route inputs after selection changes
|
|
function OnSelectionChange(el) {
|
|
event.preventDefault()
|
|
|
|
let form = el.form;
|
|
let formData = new FormData(form);
|
|
|
|
$.ajax({
|
|
headers: {"X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val()},
|
|
url: '/ru/user_account/new_route_view/',
|
|
type: "POST",
|
|
// async: true,
|
|
cache: false,
|
|
processData: false,
|
|
contentType: false,
|
|
// enctype: 'json',
|
|
data: formData,
|
|
success: function (data) {
|
|
console.log('data.html');
|
|
// location.href = '/profile'
|
|
document.querySelector(".info_profile").innerHTML = data.html
|
|
//
|
|
|
|
$('#id_weight').ionRangeSlider({
|
|
skin: "round",
|
|
type: "single",
|
|
min: 0,
|
|
max: 1000,
|
|
from: 0,
|
|
step: 1,
|
|
grid: true,
|
|
grid_num: 5,
|
|
});
|
|
|
|
}
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|