# Sortable\_element - multiple ajax events

**URL:** <https://www.ruby-forum.com/t/sortable-element-multiple-ajax-events/191839>\
**Category:** Rails\
**Created:** [July 19, 2010, 5:11pm UTC](https://www.ruby-forum.com/t/sortable-element-multiple-ajax-events/191839 "2010-07-19T17:11:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [July 19, 2010, 5:11pm UTC](https://www.ruby-forum.com/t/sortable-element-multiple-ajax-events/191839/1 "2010-07-19T17:11:25Z")

</div>

So I’m using sortable\_element to order a list. The problem I’m having  
is that if I move two items in the list very quickly, I lose the  
second move update because the backend doesn’t deal with the requests  
in sequence. It updates the database for the second move first and  
then over writes that with the first move.

Is there a simple solution to this problem. I’ve read about making the  
requests synchronous rather than asynchronous, but that doesn’t seem a  
good solution. I can’t be the only person to have come across this but  
despite much googling I can’t find a good solution.

Any help is much appreciated. Many thanks.

---

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [July 20, 2010, 6:14pm UTC](https://www.ruby-forum.com/t/sortable-element-multiple-ajax-events/191839/2 "2010-07-20T18:14:57Z")

</div>

So it appears after a bit of reading the best method of dealing with  
this problem, isn’t to deal with it directly.

It seems that providing feedback to the user (cursor into a wait state  
or a showing a spinner) that something is happening is sufficient stop  
them from doing other actions until it is completed. This seems rather  
haphazard to me. For certain operations its fine, say when you’re  
simply updating another pane with information, but becuase this is  
actually updating the database and can cause the database to not  
reflect what the user observes it doesn’t strike me a very good  
solution at all.

Does anyone care to comment on this? Is a synchronous ajax request the  
best way to go even though it locks the browser?

Thanks
