Ajaxmanager icon indicating copy to clipboard operation
Ajaxmanager copied to clipboard

How to use Events/Callbacks?

Open chobo2 opened this issue 14 years ago • 2 comments

Hi

I am using Ajaxmanager with uniqueName and I am wondering how to use these enhanced callbacks

for instance how do I use

managerName + 'AjaxStart' (global) event new

would it be

$.manageAjax.AaxStart({ ... });

Does this override the jquery AjaxStart?

chobo2 avatar Sep 13 '11 21:09 chobo2

Simply bind an event to a dom or the document node:

$('#wrapper')
     .bind('profileNameAjaxStart', function(){
           $(this).addClass('profileName-is-loading');
     })
    .bind('profileNameAjaxStop', function(){
           $(this).removeClass('profileName-is-loading');
     })
 ;

And then somewhere later do your requests:

$.manageAjax.add('profileName', {
    success: function(html) {
        $('ul').append('<li>'+html+'</li>');
    },
    url: 'test.html'
 });

aFarkas avatar Sep 13 '11 22:09 aFarkas

So I could bind it

$(document)

as I would with

$(document).ajaxStart()

Is there a difference between yours and ajaxStart?

On 9/13/2011 3:09 PM, Alexander Farkas wrote:

Simply bind an event to a dom node:

 $('#wrapper')
      .bind('profileNameAjaxStart', function(){
            $(this).addClass('profileName-is-loading');
      })
     .bind('profileNameAjaxStop', function(){
            $(this).removeClass('profileName-is-loading');
      })
  ;

And then somewhere later do your requests:

 $.manageAjax.add('profileName', {
     success: function(html) {
         $('ul').append('<li>'+html+'</li>');
     },
     url: 'test.html'
  });

chobo2 avatar Sep 13 '11 23:09 chobo2