[jQuery] AJAX Problem
[jQuery] AJAX Problem
Hi there, so I am trying out jQuery recently, moving from MooTools,
and needed to do some AJAX. Here is my code:
$(document).ready(function(){
$('#events_box a.ajax_replace').click(function(e){
e.preventDefault();
$('.news_border').slideUp('slow');
$.ajax({
method: 'get',
url: e.attr('href'),
data: { 'do' : '1' },
beforeSend: function(){
alert('beforeSend');
$('#loader').show('fast');
},
complete: function(){
alert('complete');
$('#loader').hide('fast');
},
success: function(html){
alert('success');
$('.news_border').html(html).show('slow');
}
});
});
});
As far as I have read on these groups, the documentation, and some
tutorials I found this should work. Everything before the $.ajax
request works fine, however nothing within the $.ajax gets processed.
I'm pretty positive what I am using in the data: area is wrong, it's
what I use in MooTools. However I have heard before that my current
host (Dreamhost) requires data to be sent in an AJAX request in order
to make it work, so I think I need to include something even though I
need no actual data sent in this request. Taking out the data line
does not fix the problem.
Can anyone point me in the right direction?