When i make a "POST" request through ajax, the page is loading when returning the request.
Don't we use ajax to prevent the entire page to reload ?
This is my html code:
<form method="post">
<div align="center" class="col-md-10">
    <input  type="text" id= "input" name="input" >
 </div><
 <div class="form-group">
    <button type="submit" class="btn btn-default" id="search">
     Search
    </button>
  </div>
  </form>
and this is my ajax request:
<script>
    $(document).ready(function () {
    $(".search").on('click', function () {
            var data = {};
            data['input'] = $('#input').val();
            // Submit data via AJAX§
            $.ajax({
            url: '/home',
                    type: 'post',
                    data: data,
                    success: function (data) {
                    }
            });
    });
    });
</script>
Do anyone knows how to fix this problem and what i am doing wrong !!!
 
     
     
     
     
     
     
     
     
    