开发者

jQuery Ajax stuck on beforeSend [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

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(开发者_Python百科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.


You have spelling error at sucess; should be success :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜