Setup ajax request and its handling