add functionality around ajax call