Added javascript and ajax functions