Ajax_demo: Made ajax function reusable by separating it and adding callback