removed unused variables, fixed ajax call