This commit is contained in:
Kevin Tessier 2019-06-07 19:04:55 +02:00
parent 6872b491c2
commit b3800e5e04
7 changed files with 67 additions and 34 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -168,11 +168,38 @@ function burger() {
}); });
} }
function ajaxformulaire() {
$(".ok").on('click', function () {
$(this).parent('#send-valide').remove();
location.reload();
});
var form = $('#ajax-test-form');
form.submit(function(e) {
// prevent form submission
e.preventDefault();
// submit the form via Ajax
$.ajax({
url: form.attr('action'),
type: form.attr('method'),
dataType: 'html',
data: form.serialize(),
success: function(result) {
// Inject the result in the HTML
$('#form-result').html(result);
}
});
});
}
jQuery(document).ready(function(){ jQuery(document).ready(function(){
// ajaxformulaire();
addclass(); addclass();
mapsalles(); mapsalles();
clickbutton(); clickbutton();
clicksenddevis();
links(); links();
slide(); slide();
filteritem(); filteritem();

View File

@ -977,3 +977,7 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
} }
.ok{
cursor: pointer;
}

View File

@ -1,6 +1,28 @@
{% extends 'partials/base.html.twig' %} {% extends 'partials/base.html.twig' %}
{% block content %} {% block content %}
<script>
$(document).ready(function(){
var form = $('#ajax-test-form');
form.submit(function(e) {
// prevent form submission
e.preventDefault();
// submit the form via Ajax
$.ajax({
url: form.attr('action'),
type: form.attr('method'),
dataType: 'html',
data: form.serialize(),
success: function(result) {
// Inject the result in the HTML
$('#form-result').html(result);
}
});
});
});
</script>
<div class="header-wrapper"> <div class="header-wrapper">
{% if header.entete.text == true %} {% if header.entete.text == true %}
@ -15,28 +37,4 @@
{% include "forms/form.html.twig" %} {% include "forms/form.html.twig" %}
<div id="form-result"></div> <div id="form-result"></div>
<script>
$(document).ready(function(){
var form = $('#ajax-test-form');
form.submit(function(e) {
// prevent form submission
e.preventDefault();
// submit the form via Ajax
$.ajax({
url: form.attr('action'),
type: form.attr('method'),
dataType: 'html',
data: form.serialize(),
success: function(result) {
// Inject the result in the HTML
$('#form-result').html(result);
}
});
});
});
</script>
{% endblock %} {% endblock %}

View File

@ -24,7 +24,7 @@
{% endblock %} {% endblock %}
{% block javascripts %} {% block javascripts %}
{% do assets.addJs('jquery', 101) %}
{% do assets.addJs('theme://js/jquery-3.4.1.min.js', {group:'bottom'}) %} {% do assets.addJs('theme://js/jquery-3.4.1.min.js', {group:'bottom'}) %}
{% do assets.addJs('theme://js/leaflet.js', {group:'bottom'}) %} {% do assets.addJs('theme://js/leaflet.js', {group:'bottom'}) %}
{% do assets.addJs('theme://js/imagesloaded.pkgd.min.js', {group:'bottom'}) %} {% do assets.addJs('theme://js/imagesloaded.pkgd.min.js', {group:'bottom'}) %}

View File

@ -2,14 +2,16 @@
{% set inline_errors = form.inline_errors is not null ? form.inline_errors : config.plugins.form.inline_errors(false) %} {% set inline_errors = form.inline_errors is not null ? form.inline_errors : config.plugins.form.inline_errors(false) %}
{% set status_mapping = {'success':'green', 'error': 'red', 'warning': 'yellow'} %} {% set status_mapping = {'success':'green', 'error': 'red', 'warning': 'yellow'} %}
{% set message = inline_errors and form.messages ? "FORM.VALIDATION_FAIL"|t : form.message %} {% set message = inline_errors and form.messages ? "FORM.VALIDATION_FAIL"|t : form.message %}
<script type="text/javascript">
var $ok = $('.ok');
var $send = $('#send-valide');
$ok.on('click', function () { <script type="text/javascript">
$(this).parent('#send-valide').remove();
location.reload(); $(document).ready(function(){
})
$(".ok").on('click', function () {
$(this).parent('#send-valide').remove();
location.reload();
});
});
</script> </script>