Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#10875 closed bug (worksforme)

ajaxSend(), ajaxStop() don't get triggered

Reported by: bilbo808286@… Owned by:
Priority: undecided Milestone: None
Component: ajax Version: 1.7
Keywords: Cc:
Blocked by: Blocking:

Description

I'm trying to get een event triggered when ajax starts/stops loading data. I've been using the events ajaxSend() and ajaxStop(), as documented on your site, but i can not get them to work. I've simplified my code (see below) to isolate the problem, without result.

Finaly i managed to get it working by switching back to jQuery 1.3.2. Any later version i tried (up to 1.7) keeps having the issue. Is this an actual bug, or am i doing something wrong? (I admit that i'm new to jQuery, but i asked an experienced user and he could not find the flaw in my code)...

Link to sample code: [http://jsfiddle.net/Fegd4/2

Sample code:

<!DOCTYPE html>
<html>
   <head>
      <title>testpage</title>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <link rel='stylesheet' type='text/css' href='jquery/css/ui-lightness/jquery-ui-1.8.16.custom.css' />
      <!-- <script type='text/javascript' src='jquery/js/jquery-1.6.2.min.js'></script>  -->
      <script type='text/javascript' src='jquery/js/jquery-1.7.min.js'></script>
      <!-- <script type='text/javascript' src='lib/jquery/jquery-1.3.2.min.js'></script> -->
      <script type="text/javascript">
         $().ajaxSend(function() {
            alert('trigger ajaxSend');
         });
         $().ajaxStop(function() {
            alert('trigger ajaxStop');
         });


         // document.ready
         $(function() {
            $('#callAjax').click(function() {                // event  handler
               alert('trigger #callAjax.click');      // debug info
               $.get("test.txt", "", function(data) {       // de AJAX call
                  $('#outputAjax').html(data);              // output
               });
            });
         })// document.ready
   
      </script>
   </head>
   <body>
      <h1> testpage </h1>
      <h2> testing Ajax event triggers</h2>
      <p>Ajax call 'test.txt': <a href="#" id="callAjax">Click here to execute Ajax call</a> </p>
      <div id="outputAjax">
         This text will be replaced with the content of test.txt
      </div>

   </body>
</html>

Change History (2)

comment:1 Changed 7 years ago by jaubourg

Resolution: worksforme
Status: newclosed

http://jsfiddle.net/qw6VM/

It's the semantics of $() that changed.

comment:2 Changed 7 years ago by jaubourg

Component: unfiledajax
Note: See TracTickets for help on using tickets.