Adding ajax handlers to the javascript