replaced ajax codes with equivalent javascript code for testing purpose