Implemented promise object for AJAX call