Currently having problems with jQuery Ajax calls. It's stuck at beforeSend
, no alert is sent from error or success. How come?
Code:
$('#addpost button').click(function(e) {
e.preventDefault();
var $post = $('#addpost textarea').val();
var $subject = $('#addpost input').val();
$.ajax({
url: 'plugins/loggboken/ajaxcalls/post.php',
data: { post: $post, subject: $subject },
beforeSend: function() {
$('#ajaxload').show();
},
error: function() {
$('#ajaxload').hide();
alert('Fel inträffades. Ladda om sidan och försök igen.');
},
sucess: function (d) {
$('#ajaxload').hide();
alert(d);
}
});
});
I know the Ajax is running as my ajaxload
div
is starting to show when the button is pressed.