0.0.17 send new route form v2
This commit is contained in:
@@ -1,19 +1,25 @@
|
||||
function sendRoute(){
|
||||
function sendRoute(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/',
|
||||
url: '/ru/routes/create_route/',
|
||||
type: "POST",
|
||||
// async: true,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
// enctype: 'json',
|
||||
// data: {},
|
||||
data: formData,
|
||||
success: function(data){
|
||||
console.log('data received')
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html
|
||||
// document.querySelector(".info_profile").innerHTML = data.html
|
||||
},
|
||||
error: function (data, exception){
|
||||
document.querySelector(".new_route").innerHTML = data.responseJSON.html
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<form name="new_route" method="post">
|
||||
<form class = "new_route" name="new_route" method="post">
|
||||
{% csrf_token %}
|
||||
<div>
|
||||
<label for="id_type_transport">{{ form.fields.type_transport.label }}</label>
|
||||
@@ -66,8 +66,8 @@
|
||||
<input type="text" name="phone"{% if form.fields.phone.required %} required{% endif %} id="id_phone">
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_add_phone">{{ form.fields.add_phone.label }}</label>
|
||||
<input type="text" name="add_phone" id="id_add_phone">
|
||||
<label for="id_extra_phone">{{ form.fields.extra_phone.label }}</label>
|
||||
<input type="text" name="extra_phone" id="id_extra_phone">
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_receive_msg_by_email">{{ form.fields.receive_msg_by_email.label }}</label>
|
||||
|
||||
Reference in New Issue
Block a user