Development

Re: Development

by Mark Johnson -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
To literally refresh the browser window, you just do document.location.reload() in Javascript. However, if you want the page to update to reflect the latest changes, the better way to do that from a User Experience point of view is to use Javascript to fetch the updated content in the background using an XMLHttpRequest and display it on the current page. This technique is usually called "AJAX".

I suggest you start by learning about AJAX outside of Moodle (I bought a book), then read jQuery's AJAX documentation, and Moodle's AJAX documentation.
Doing AJAX requests in plain jQuery requires more verbose Javascript than Moodle's way of doing it, but Moodle's way of doing it requires you to create a web service function rather than calling a simple PHP script which is another thing to learn if you haven't already.
Average of ratings: Useful (1)