implemented ajax call to insert data into database