data retrieval safety for AJAX api calls