skip to Main Content

This code is working perfectly on mozila(103.0) but, it is not working on chrome or microsoft edge.

$('#loading').bind('ajaxStart', function () {
  $(this).show();
}).bind('ajaxStop', function () {
  $(this).hide();
});

on console it gives Notice :

Synchronous XMLHttpRequest on the main thread is deprecated because of
its detrimental effects to the end user’s experience.

2

Answers


  1. I would say that you might forgot to wait for document being ready:

    
    $(document).ready(function(){
    
      $('#loading').bind('ajaxStart', function () {
        $(this).show();
      }).bind('ajaxStop', function () {
        $(this).hide();
      });
    
    });
    
    Login or Signup to reply.
  2. As .bind() method is deprecated. You can use .on() method instead.

    $(document).ready(function(){
    
      $('#loading').on('ajaxStart', function () {
        $(this).show();
      }).bind('ajaxStop', function () {
        $(this).hide();
      });
    
    });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search