ajax_demo: improved code in ajax js and php files