This commit is contained in:
SDE
2023-08-01 19:20:23 +03:00
parent b0a9c3c873
commit 265444eda6
3 changed files with 9 additions and 4 deletions

View File

@@ -51,7 +51,7 @@ def edit_route_ajax(request):
print(msg)
return JsonResponse({'errors': msg})
html = render_to_string('blocks/profile/b_new_route2.html', Dict, request=request)
html = render_to_string('blocks/profile/b_new_route.html', Dict, request=request)
return JsonResponse({'html': html}, status=200)

View File

@@ -227,10 +227,15 @@ function onblurInputField(event,el){
// }
function sendRoute(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])
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
@@ -241,7 +246,7 @@ function sendRoute(el){
processData: false,
contentType: false,
// enctype: 'json',
data: formData,
data: JSON.stringify(data),
success: function(data){
console.log('data received')
// location.href = '/profile'

View File

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