Files
v1.xevion.dev/app/templates/dashboard/profile_settings.html
2019-07-04 11:59:42 -05:00

42 lines
1.4 KiB
HTML

{% extends '/dashboard/dashboard_base.html' %}
{% set profile_settings_active = True %}
{% block head %}
{{ super() }}
<script>
$(document).ready(function () {
$('form').submit(function (e) {
var url = "{{ url_for('profile_settings_submit') }}"; // send the form data here.
$.ajax({
type: "POST",
url: url,
data: $('form').serialize(), // serializes the form's elements.
success: function (data) {
console.log(data) // display the returned data in the console.
}
});
e.preventDefault(); // block the traditional submission of the form.
});
// Inject our CSRF token into our AJAX request.
$.ajaxSetup({
beforeSend: function (xhr, settings) {
if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {
xhr.setRequestHeader("X-CSRFToken", "{{ form.csrf_token._value() }}")
}
}
})
});
</script>
{% endblock head %}
{% block dashboard_body %}
<section>
<h1 class="title">Profile Settings</h1>
<form action="" method="POST" novalidate>
{{ form.hidden_tag() }}
<div class="field">
{{ form.show_email.label }}
{{ form.show_email(class="_input") }}
</div>
{{ form.submit }}
</form>
</section>
{% endblock dashboard_body %}