0

I have the following javascript code, and I need to refresh the current page after its succesful

shouldnt be that hard?

function UpdateToCompleted(itemId) {
        var clientContext = new SP.ClientContext.get_current();
        var oList = clientContext.get_web().get_lists().getByTitle('Bill Cycles');
        this.oListItem = oList.getItemById(itemId);
        oListItem.set_item('StatusColumn', 'Completed');
        oListItem.update();
        clientContext.executeQueryAsync(Function.createDelegate(this, this.StatusCompletedSucceeded), Function.createDelegate(this, this.StatusCompletedFailed));
    }

    function StatusCompletedSucceeded() {
        alert('Item updated!');
    }
Luis Valencia
  • 32,619
  • 93
  • 286
  • 506
  • Do you mean refresh the data on the page, or reload the page completely? – Andy Mar 03 '14 at 12:24
  • possible duplicate of [how to refresh a page using javascript?](http://stackoverflow.com/questions/5294842/how-to-refresh-a-page-using-javascript) – rusmus Mar 03 '14 at 12:25

3 Answers3

3

You can use

function StatusCompletedSucceeded() {
        window.location.reload();
 }
GajendraSinghParihar
  • 9,051
  • 11
  • 36
  • 64
2

You could do this:

window.location.href = window.location.href;

or this:

window.location.reload(true);

The parameter specifies whether or not to force the page to be loaded from the server.

https://developer.mozilla.org/en-US/docs/Web/API/Location.reload

rusmus
  • 1,665
  • 11
  • 18
2
window.location.reload();

Should do it

Khalid Dabjan
  • 2,697
  • 2
  • 24
  • 35