tags:

views:

22

answers:

1

Hi there,

I've got some basic code with jquery:

$.get("/booking.php", { event_id: event_id, time_id: time_id }, function(data) {
    $('#booking_box_content').html(data);
  });

Which works a treat. Thing is, i'd like to do something before the actual get command is sent. I know the above code is the shorthand, and I know how to do the longhand version with $.ajax() and beforeSend() - I guess i'm wondering if there is a way to do that with $.get()...

+2  A: 

Not about get, but you might find another way of using beforeSend more convenient:

$.ajaxSetup({
    beforeSend: function(request) {
        // do your stuff
    }
});

This would register beforeSend handler for all ajax requests made through jquery.

Nikita Rybak
for ALL ajax requests? that is pretty cool... could definitely come in useful for loading a default 'loader' or something.
KeenLearner