按下按钮后调用javascript代码,然后刷新页面

i'm trying to start a php script after i press a button, and then reload the page, but i have a problem, now i do this:

<a href="#" class="btn green big" onclick="startUpdate();">Start Update</a>

then this is the script:

<script type="text/javascript">
    function startUpdate() {
        $.get("Update/startUpdateTxt.php");
        return false;
    }
</script>

these script write on a txt file, all works perfect but i want refresh the page because i have to change some element and read the change i make in the txt file, so i have tried to do this:

 <script type="text/javascript">
    function startUpdate() {
        $.get("Update/startUpdateTxt.php");

        return window.location.href=window.location.href;
    }
</script>

in this way, the page is refreshed but the phpscript doesn't work anymore, and doesn't write anything in the file, this is the phpscript:

startUpdateTxt.php:

<?php
$myFile = "updateStatus.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "StartUpdate
";
fwrite($fh, $stringData);
fclose($fh);
?>

how i can do to refresh the page and call in background the phpscript?

You would need to make sure that your ajax call finishes. To do that, you could place your redirect in the callback function:

function startUpdate() {
    $.get("Update/startUpdateTxt.php", function() {
      location.reload();
    });
}

However, it does not really make a lot of sense (to me...) to use ajax to call a php script and then redirect, it would be easier to just post to the php script and handle everything from there.