Added ajax functions. This where all ajax related functions must be implemented. Please remember the conventions.