Avoid duplicate code

Inside ```getData``` there are the same functions twice. Now there a
function named ```renderData``` that append the html and call the
callbacks