This commit is contained in:
2023-08-29 14:53:33 +03:00
parent 90f880ee70
commit 4cd6d1d0f5
4 changed files with 74 additions and 8 deletions

View File

@@ -1450,4 +1450,14 @@
.from_address_point_txt.find_route{
}
.button-find-more-routes{
width: 220px;
height: 60px;
background: #FF613A;
color: #FFFFFF;
font-size: 18px;
font-weight: 600;
border-radius: 10px;
}

View File

@@ -0,0 +1,47 @@
let page_iterator = 2
function load_routes (el) {
event.preventDefault()
// let el_parent = el.parentNode
// let new_el = el_parent.previousSibling.previousSibling
// let new_el_dataset = new_el.dataset
// if (new_el_dataset){
// let number_last_route = new_el_dataset['numberOfRoute']
let number_last_route = el.dataset['lastRoute']
let data = {
'from_el':parseInt(number_last_route) + 1,
'to_el':parseInt(number_last_route) + 11
}
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/routes/find_routes/',
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
data: JSON.stringify(data),
success: function(data){
// new_el.parentNode.insertBefore(data.html, new_el.nextSibling);
let url_insert = ".page_routes_" + page_iterator
document.querySelector(url_insert).innerHTML = data.html
let old_page_iterator = page_iterator
page_iterator++
let new_page_routes = document.createElement("div")
new_page_routes.classList.add("page_routes_" + page_iterator)
$(new_page_routes).insertAfter(".page_routes_" + old_page_iterator);
// document.querySelector(".info_profile").innerHTML = data.html;
},
error: function (data){
document.querySelector(".info_profile").innerHTML = data.responseJSON.html;
}
});
// }
}