code to insert slash if needed when calculating url for ajax call