Separate ajax result processing and dom creation into two methods