add ajax and fix bug