Finished working model of the ajax functionality.