[SalesForce] Refresh Page After OnClick

I have a custom VF page acting as a button. When the button is refreshed, a checkbox is either checked or unchecked. All that works fine, but I cannot figure out a way to reload the page after the function is called. Can anyone help? Thanks,

<script src="/soap/ajax/35.0/connection.js"/>

<script type="text/javascript">
    function Escalate(){
      var confirmMsg = confirm("Are you sure you want to escalate to the Client?");
        var c = new sforce.SObject("Case");
      if(confirmMsg == true){
          c.id = "{!Case.Id}";
          c.Escalate_to_Client__c = true;
        sforce.connection.update([c]);  
      }
      else{
          return false;;  
      }
      window.location.reload();
      }

    function Rescind(){
      var confirmMsg = confirm("Are you sure you want rescind the escalation to the Client?");
        var c = new sforce.SObject("Case");
      if(confirmMsg == true){
          c.id = "{!Case.Id}";
          c.Escalate_to_Client__c = false;
        sforce.connection.update([c]);  
      }
      else{
        return false;
      }
        window.location.reload();
    }
</script>

    <apex:form >
    <center>
        <apex:pageBlock mode="maindetail" >
            <apex:pageBlockButtons location="Top" >
            <div style="width:400px;">
                <apex:commandButton value="Escalate To Client" onClick="Escalate()" rendered="{!IF(Case.Escalate_To_Client__c = false, TRUE,FALSE)}"/>
                <apex:commandButton value="Rescind Escalation To Client" onClick="Rescind()" rendered="{!IF(Case.Escalate_To_Client__c = true, TRUE,FALSE)}"/>
            </div>
            </apex:PageBlockButtons>
        </apex:PageBlock>

Best Answer

This functionality works for me. If I include the below Visualforce Page in a Page Layout and click the button, it refreshes the whole page.

<apex:page standardController="Case">
    <apex:form>
        <apex:commandButton value="Reload" onclick="window.location.top.reload();" />
    </apex:form>
</apex:page>

That implies the following should work:

<apex:commandButton value="..." onClick="..."
    oncomplete="window.top.location.reload()" />

Failing that, perhaps try:

<apex:commandButton value="..." onClick="..."
    oncomplete="window.top.location = {!URLFOR($Action.Case.View, Case.Id)}" />
Related Topic