adds headers to ajax call and to view