Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Live updating search filters

edited March 2013 in Framework

A site like, with many, many filters to choose from that all update dynamically as soon as you make a selection -- is that all jquery driven? I would love to set up something similar for a client but I'd want to let the client specify which fields to expose. Is that too meta-ish for a CMS? Example page:


  • edited March 2013

    That would best be done via jQuery on the page itself calling to a REST API behind the scenes. Elefant does have a pretty easy way of building REST APIs though, through the Restful class:

    On the client, you would create an AJAX call like this:

    function update_table_from_filters () {
        // Build your params
        var params = {
            server_type: $('#server-type').val (),
            monthly_cost: [
                $('#monthly-cost-low').val (),
                $('#monthly-cost-high').val ()
            // etc.
        // Post to the server for an update
        $.post ('/myapp/api/find_results', params, function (res) {
            if (! res.success) {
                console.log ('Error: ' + res.error);
            // update the table with your results
            console.log (;

    The above would correspond to the following PHP:

    <?php // apps/myapp/handlers/api.php
    namespace myapp;
    class API extends \Restful {
        public function post_find_results () {
            // do search with $_POST data,
            // e.g., $_POST['server_type'], etc.
    $this->restful (new API);
  • Thanks! I'll try it.

Sign In or Register to comment.