I have created a form which insert the location of some users in database and these data should appear in the page. The problem is that the page doesn't reload by itself after I fill the form but I have to make a page reload.Or if the page is opened in another browser it doesn't reload. Is there a way that this page reloads by itself without making any action after I insert some data in database from this form?
You can refresh the page after your completing your operation using jquery as
Javascript 1.0
window.location.href = window.location.pathname + window.location.search +window.location.hash;
// creates a history entry
Javascript 1.1
window.location.replace(window.location.pathname + window.location.search + window.location.hash);
// does not create a history entry
Javascript 1.2
window.location.reload(false);
Use the assign() method. The assign() method is supported in all major browsers.
window.location.assign(data); "data being the URL"
or
window.location.href
function myFunction() {
location.assign("http://www.example.com");
}
<button onclick="myFunction()">Load new document</button>
Ok thanks! Functions onClick eventhough I have an ng-click in side this button?
Yes it will still function properly. See JSFiddle demo
Edit: I saw you had this in your code?
window.history.back(); or location.reload();
consider replacing with with:
window.location.replace("pagehere.html");
</div>