开发者

Sending several JSON requests creates a 500 error

This JSON post works, but 开发者_开发知识库if I start clicking them quickly, they start returning 500 errors. I'm guessing this is because they're not queueing correctly, and they fall apart when they can't go out one by one. Is there a way to queue this in JSON?

Here's my button in HAML :

= f.check_box :has_sticker, :style => 'width: 20px;', :class => "orgs_deals_admin_save"

And here's my jQuery :

$('.orgs_deals_admin_save').live('click', function() {
    var button = $(this);
    var form = button.closest('form');
    var dataString = form.serialize();
    $.ajax({
        url: form.attr('action') + '.json',
        dataType: 'json',
        type: 'POST',
        data: dataString,
        success: function(data) {
        }
    });
});


This is because per default asynchronous is set to true. If you want them to be processed in the exact same order you sent them, set asynchronous to false.


500 is server error problem code, so i suppose that there is some problem with processing your script on the server side

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜