Refresh Detail view after firing javascript function

not able to accomplish this.

Custom button which run javascript that do ajax request on custom action controller.
If result is ok then i would to refresh the detail view where the button is placed.

Tried this:

 let url = window.location.href;

but it gives me an error:
Invalid URL

Any help would be appreciate.

And also is there any way to refresh only some fields instead the whole page?

Many thanks

Check this two samples:

I’ve already seen the first example however seems that location.reload(true) is deprecated.

So I am searching for a better way to do this.

Any hint?

This is the solution i’ve found so far, maybe can helps someone.

function refresh(message) {

In this way the browser do a refresh after user click ok on alert message.

I think a full page refresh should be avoided, instead the Ajax architecture should be used to make things less obvious to the user.

However - I don’t know how to do it, sorry.

Totally agree…
Currently not found a better way…