handling the basebath of the ajax calls