Trial code to remove 'another command is already in progress'

This code makes the process wait for all of the Ajax calls end.
https://gist.github.com/josevalim/470808
http://qiita.com/kntmrkm/items/a02f5694843fee97763e