clean up redundant code in loadAjax