Is there some smart way of customizing ajax message text in jQuery?

Posted by Fedor on Stack Overflow See other posts from Stack Overflow or by Fedor
Published on 2010-03-25T14:16:25Z Indexed on 2010/03/25 14:33 UTC
Read the original article Hit count: 409

Filed under:
|

I have tons of ajax components on this booking engine. I need to customize the text inside of the modal for each of the components to suite.

I added:

    $('#loader').bind('ajaxStart', function() {
        $(this).show().addClass('modalOpen');
    }).bind('ajaxComplete', function() {
        $(this).removeClass('modalOpen').hide()
    });

Is there some advanced way of changing the text inside of the loading element before I do separate .ajax calls? Or do I just have to manually do something like

$('#loader').text('blah');
$.ajax({})

Furthermore, this may sound silly but is there a way to not have the loader show up for certain components? If not I imagine I'll have to do something like

$('someel').someEvent(function() {
    $('#loader').addClass('override-hide');
    $.ajax({
       success:function() {
          $('#loader').removeClass('override-hide');
       }
    })
})

#loader.override-hide { display:none !important; }

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX