created 'record' function for show view page - ajax