HubSpot Code Block | HubDev

HubSpot HubDB AJAX Filters: Dynamic CMS Content & UX

Written by Deepak Jha | 14 July 2025

Ever visited a website where listings (like team members, projects, or blog posts) instantly update when you pick a filter, without the whole page reloading? That's the magic of HubDB with AJAX filters on HubSpot CMS! It means a super-fast, smooth experience for your visitors, keeping them engaged and happy.

If you have dynamic content on your HubSpot site – like lists of team members, case studies, product catalogs, or blog articles – this guide is for you! We'll show you how to build awesome filters that make your content easy to explore.

Why It's Great for Your Website:

  • Blazing Fast: No more waiting for pages to reload. Content updates instantly.

  • Happy Visitors: A smooth experience means people stay longer and find what they need faster.

  • Better Engagement: Interactive filters encourage users to explore more of your content.

  • Easy to Use: Once set up, managing your dynamic content is a breeze.

How It Works (The Simple Idea):

  1. Your HubDB Table: Imagine a smart spreadsheet (HubDB) where you store all your project details: name, category, image, etc.

  2. Initial Display: Your HubSpot page first shows all your projects using a special HubSpot module. It also displays a "category" dropdown filter.

  3. The "Magic" (AJAX): When someone picks a category from the filter, a tiny signal is sent behind the scenes (that's AJAX!).

  4. Instant Update: HubSpot quickly grabs only the projects matching that category and sends them back. Your page then instantly updates, showing just those projects, without a full refresh!

Step-by-Step Simplified:

1. Set Up Your Data (HubDB):

Create your HubDB table. For example, a "Projects" table might have columns like:

  • Project Name (text)

  • Category (like "Marketing," "Design," "Development")

  • Image

  • Summary

2. Build Your Page (HubSpot):

On your HubSpot page, you'll add two main parts:

  • The Filter: A dropdown menu (using HubSpot's code) that lists all your project categories.

  • The Content Area: A special placeholder where your projects will appear. This area uses a HubSpot module to display the initial list.

3. The Content Display Module:

This is a HubSpot module that knows how to show your projects. It checks if a filter is active and only displays projects that match.

4. The Smart Script (JavaScript):

This little piece of code makes it all work. When you select a category in the dropdown:

  • It tells your HubSpot page what category was chosen.

  • It asks the HubSpot server for just the projects in that category.

  • When the server sends them back, it instantly updates the "Content Area" on your page. No full page reload needed!

Pro Tips for a Great Experience:

  • Loading Spinners: Add a small "loading..." message or spinner while the content updates, so users know something's happening.

  • "No Results" Message: If a filter returns nothing, tell the user, "No items found."

  • Pagination: If you have many items, add "Next Page" and "Previous Page" buttons that also update instantly.

  • Keep it Simple: Focus on the main filters your users will need.

Where You Can Use This:

This powerful technique is perfect for:

  • Blog Filters: Let visitors easily find posts by topic.

  • Team Directories: Filter team members by department.

  • Product Listings: Organize products by features or types.

  • Case Study Portfolios: Let clients browse by industry.

By adding these dynamic, instant filters to your HubSpot website, you'll create a much more engaging and user-friendly experience, making your content shine!