Sending multiple JSON requests generates 500 error

This JSON message works, but if I quickly click on them, they will start returning 500 errors. I guess this is because they are not in the queue correctly, and they fall apart when they cannot go out one by one. Is there a way to queue in JSON?

Here is my button in HAML:

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

And here is 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) { } }); }); 
+4
source share
2 answers

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

+1
source

500 is the server error code, so I assume there is some problem with processing your script on the server side

+1
source

Source: https://habr.com/ru/post/1316416/


All Articles