uses proper format for AJAX reponses