ajax
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -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(){
 | 
			
		||||
  // ajaxformulaire();
 | 
			
		||||
  addclass();
 | 
			
		||||
  mapsalles();
 | 
			
		||||
  clickbutton();
 | 
			
		||||
  clicksenddevis();
 | 
			
		||||
  links();
 | 
			
		||||
  slide();
 | 
			
		||||
  filteritem();
 | 
			
		||||
 
 | 
			
		||||
@@ -977,3 +977,7 @@
 | 
			
		||||
    margin-bottom: 10px;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.ok{
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,28 @@
 | 
			
		||||
{% extends 'partials/base.html.twig' %}
 | 
			
		||||
 | 
			
		||||
{% 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">
 | 
			
		||||
    {% if header.entete.text == true %}
 | 
			
		||||
@@ -15,28 +37,4 @@
 | 
			
		||||
    {% include "forms/form.html.twig" %}
 | 
			
		||||
<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 %}
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@
 | 
			
		||||
      {% endblock %}
 | 
			
		||||
 | 
			
		||||
      {% 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/leaflet.js', {group:'bottom'}) %}
 | 
			
		||||
          {% do assets.addJs('theme://js/imagesloaded.pkgd.min.js', {group:'bottom'}) %}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,14 +2,16 @@
 | 
			
		||||
  {% 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 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 () {
 | 
			
		||||
      $(this).parent('#send-valide').remove();
 | 
			
		||||
      location.reload();
 | 
			
		||||
    })
 | 
			
		||||
  <script type="text/javascript">
 | 
			
		||||
 | 
			
		||||
    $(document).ready(function(){
 | 
			
		||||
 | 
			
		||||
      $(".ok").on('click', function () {
 | 
			
		||||
        $(this).parent('#send-valide').remove();
 | 
			
		||||
        location.reload();
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
  </script>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user