This commit is contained in:
SDE
2023-08-01 19:41:10 +03:00
parent d9563aff29
commit 88a1534eb2
2 changed files with 7 additions and 7 deletions

View File

@@ -229,13 +229,12 @@ function onblurInputField(event,el){
function sendRoute(el, routeID = null){
event.preventDefault()
let route_obj = {
'route_id': routeID
}
let form = el.form;
let formData = new FormData(form);
let data = new Object([route_obj, formData])
let add_url = ''
if (routeID !== null){
add_url = routeID
}
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
@@ -246,7 +245,7 @@ function sendRoute(el, routeID = null){
processData: false,
contentType: false,
// enctype: 'json',
data: JSON.stringify(data),
data: formData,
success: function(data){
console.log('data received')
// location.href = '/profile'
@@ -274,6 +273,7 @@ function sendRoute(el, routeID = null){
//cleaning route inputs after selection changes
function OnSelectionChange(el) {
event.preventDefault()

View File

@@ -295,7 +295,7 @@
{% endif %}
</div>
<div class="button_register">
<button id="registration" onclick="sendRoute(this, {{ route.id }})"> Разместить объявления </button>
<button id="registration" onclick="sendRoute(this, {% if route.id%}{{ route.id }}{% endif %})"> Разместить объявления </button>
</div>