I have function which I need to send data with POST method, and after the POST has been sent, to refresh page. But every time it asks user "An alert requires attention. Are you sure you want to close this page?". Is there way to just force refresh without asking user for permission? Right now I'm using "window.location = window.location.href;" but it asks user anyway.
function clickedNew(file){
var http = new XMLHttpRequest();
http.open("POST", "./script.php", true);
http.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset=utf-8");
var params = "fileName=" + file + "&fileNum=" + <?php echo $count; ?>;
http.send(params);
http.onload = function() {
window.location = window.location.href;
}
}