refactor application.js ajax returned html