Reload page after message is shown, jQuery

Use the setTimeout method to get the delay, and the reload method to reload the page. Note the true parameter in the reload call to ensure that the page is actually reloaded, and not just repainted from the cache.

window.setTimeout(
  function(){
    location.reload(true)
  },
  3000
);

You could add a delay by using the setTimeout() function, such as:

// This will reload the page after a delay of 3 seconds
window.setTimeout(function(){location.reload()},3000)

For your needs:

$.ajax({
      type: "POST",
      url: "scripts/process.php",
      data: dataString,
      success: function() {
           $("#st_message").html("<p> Your article was successfully added!</p>");
           window.setTimeout(function(){location.reload()},3000)
      }
});
return false;

Working Example


Do you mean something like : window.location.reload() in JavaScript


Do it with something like:

function delayedRedirect(){
    window.location = "/index.php"
}

setTimeout('delayedRedirect()', 3000)

setTimeout is used to delay the redirect function call, in this case you can redirect somewhere to a new URL (just in case you need that too).

Otherwise use location.reload() to reload page.