I don't know much about how CkEditor works, so this may not be applicable, but shouldn't we be returning a "application/json" response and using a callback in the frontend to call functions rather than returning HTML?