simplify ajax and remove jquery dependency