0

I am trying to get this form to close when the button is pressed without the page refreshing. Someone else will then place in the Ajax code. This form is a pop up, so the pop up needs to close. Currently I can click the button without refresh, but I need the popup box to close. I have found various using Ajax etc, but as said someone else will be putting in the Ajax after I can get it to close. This is the form code

<div id="contact_form">
  <form role="form">
    <div class="form-group">
      <label for="rangeStart1">Range Start</label>
      <input type="text" class="form-control" id="rangeStart3" placeholder="Range Start">
    </div>
    <div class="form-group">
      <label for="rangeFinish1">Range Finish</label>
      <input type="text" class="form-control" id="rangeFinish3" placeholder="Range Finish">
    </div>

    <button type="submit" class="btn btn-default">Submit</button>
  </form>
</div>

Here is the function (which I found here on Stackoverflow)

 function sendContactForm(){
 $('#contactForm').submit(function () {
     sendContactForm();
     return false;
 });
Jai
  • 74,255
  • 12
  • 74
  • 103
Ronan2505
  • 19
  • 1
  • 3
  • 10

1 Answers1

0

A little bit of gigging o the html, and this is wha made i work for me,

$(document).ready(function() {

    $('#form-1').submit(function(e) {
        e.preventDefault();
        $.get($(this).prop('action')+'?' + $(this).serialize());
        $('#myModal').modal('hide');
    });

    $('#form-2').submit(function(e) {
        e.preventDefault();
        $.get($(this).prop('action')+'?' + $(this).serialize());
        $('#myModal-1').modal('hide');
    });
});

Thanks to Upendrasinh Jadeja for guidance

Ronan2505
  • 19
  • 1
  • 3
  • 10