fix #8, rewrite js code and ajax response code