add ajax and fixed bug