Pete Jones Posted April 23, 2016 Posted April 23, 2016 Hi, I've got a long list of items to show. The list is a big table and when you click on a table row, additional information is shown (hidden table row). Part of this table row contains an image. Currently when I load the page, I'm loading all of the images too (not good), so I want to load the extra content onclick using AJAX. I'm using the delayed output model (_main.php/_init.php). How do I configure my templates so I can call a URL by AJAX and output the required content? Many thanks Pete
DaveP Posted April 23, 2016 Posted April 23, 2016 This thread might help - https://processwire.com/talk/topic/225-how-to-work-with-ajax-driven-content-in-processwire/ 3
Pete Jones Posted April 23, 2016 Author Posted April 23, 2016 Neat. So for my page template I can put $config->ajax to check and render something else. The only problem is that I'm still returning the rest of my _main.php file. Can I prevent it loading for AJAX requests?
arjen Posted April 23, 2016 Posted April 23, 2016 You can halt() like this: <?php if ($config->ajax) { // Do your stuff here echo 'Heard It Through The Grapevine'; // Call halt() to prevent further loading return $this->halt(); } 4
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