change cursor to progress before send out ajax request.
some code reorganize.