Edit: Important: It is extremely unlikely that anybody who has come across this will have the exact same problem as me - check my answer below for my very obscu
append
does not replace your div. It pastes the data at the back of your div.
You could try
replaceWith( content )
instead.
replaceWith in jQuery documentation