ajax_demo: Separated generateDialog into a different file for ajax functions