0

I want to display a loading gif before load and hide it after load. Right now I have this:

<div id="loading-image" style="display: none">
  <i class="fa fa-cog fa-spin fa-3x fa-fw"></i>
  <span class="sr-only">Loading...</span> 
</div>
$("#82348").submit(function(event) {
  event.preventDefault();
  var form = $(this);

  $.ajax({
    type: "post",
    url: "{{ url('search') }}",
    dataType: "json",
    data: form.serialize(),
    beforeSend: function() {
      $('#searchResults').empty(); $("#loading-image").show(); 
    },
    success: function(data) {
      $("#loading-image").hide();
      // rest of ajax

However this is not working. Nothing is happening. Any suggestions?

Rory McCrossan
  • 319,460
  • 37
  • 290
  • 318
harunB10
  • 4,155
  • 13
  • 52
  • 94

0 Answers0