consolidated seperate get, put, post, and delete AJAX calls into one method.