broke the ajax call into its own method so we can easily reuse the code