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.