Finished main panel's ajax functionality