ajax_demo: optimized javascript