score:6

Accepted answer

You can achieve this by first appending the fragment to the URL, then reloading the page:

window.location.href += '#post-' + data.post_id;
window.location.reload();

Note however that you could improve this further by using pushState and avoiding the need to reload the page at all when the fragment changes.

score:0

You can use

location.reload();

Please, see http://www.w3schools.com/jsref/met_loc_reload.asp


Related Query

More Query from same tag