moved ajax functions to ajax.js from html templts