Jump to content

Recommended Posts

Posted

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

Posted

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?

Posted

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();
}
  • Like 4

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...