louisstephens Posted April 29, 2017 Posted April 29, 2017 I have been wanting to set up a quick "dashboard" for a recent project, and was considering using ajax to get a "real time" update/refresh on the page (some of my output depends on the datetime field). I know how to get the desired output using php with some if statements comparing todays date to the date stored in the field, however, I am a bit at a lose of how to interact with the ProcessWire API using ajax to get the desired effect. I found the following and know that I need to start off with: <?php if($config->ajax) { // page was requested from ajax } Unfortunately, as I mentioned earlier, how would one actual find pages using a template and get the field contents from them using AJAX? I apologize if this seems bit broad, but I am stil getting a grasp of using AJAX to deliver content to get a real time update on a page without refresh.
abdus Posted April 29, 2017 Posted April 29, 2017 AJAX or normal request doesn't really matter to backend. You just detect if request is an AJAX request and act accordingly. Because I had some things to do, I decided to procrastinate by building a simple module and write a tutorial for it. 4
rick Posted April 29, 2017 Posted April 29, 2017 @abdus, Very nicely done! Thanks for your procrastination. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now