Merge the two ajax function in the ajax.js file.