Refreshing Kibana from plugin

I'm updating a plugin for Kibana and earlier (in 4.6.x) the page refresh was implemented by replying with html that contained a JS script. Same actions end in Unexpected token '<' errors in Kibana now (7.3).

Is there maybe a different approach to passing the command to frontend or a way to fix the '<' error?

Thanks

Yeah. In general, we don't allow API requests to return executable code. JSON is fine. I think you'll need to update your plugin's front-end and back-end to handle this scenario.

So, your back end might reply with { action: 'refresh' } and your front end would handle that response and do a page refresh.