HTML5 JS Ruby State Engine - the right way of ajax