PageSourceSearch

https://tickettobiotech.com/wp-content/themes/tickettobiotech/assets/js/pmpro-directory-ajax.js

js tickettobiotech.com collected 2026-09-30 15:40:30 UTC 2,509 bytes, 63 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2	const form = document.querySelector('.pmpro-member-directory-filters');
3	const resultsContainer = document.querySelector('#pmpro-ajax-results');
4	const paginationContainer = document.querySelector('#pmpro-ajax-pagination');
5    const searchForm = document.querySelector('.pmpro-search-form');
6
7	if (!form || !resultsContainer) return;
8
9    function fetchResults(page = 1) {
10        const formData = new FormData(form);
11        formData.append('action', 'pmpro_ajax_member_directory');
12        formData.append('pn', page);
13    
14        // Include search input if present
15        const searchInput = document.querySelector('input[name="ps"]');
16        if (searchInput && searchInput.value.trim() !== '') {
17            formData.append('ps', searchInput.value.trim());
18        }
19        document.getElementById('pmpro-ajax-spinner').style.display = 'block';
20
21        
22        fetch(pmpro_ajax.ajax_url, {
23            method: 'POST',
24            body: formData,
25        })
26            .then(response => response.text())
27            .then(html => {
28                const tempDiv = document.createElement('div');
29                tempDiv.innerHTML = html;
30    
31                const newResults = tempDiv.querySelector('#pmpro-ajax-results');
32                const newPagination = tempDiv.querySelector('#pmpro-ajax-pagination');
33    
34                if (newResults && resultsContainer) {
35                    resultsContainer.innerHTML = newResults.innerHTML;
36                }
37                if (newPagination && paginationContainer) {
38                    paginationContainer.innerHTML = newPagination.innerHTML;
39    
40                    document.querySelectorAll('.pmpro-page').forEach(btn => {
41                        btn.addEventListener('click', function () {
42                            const page = this.dataset.page;
43                            fetchResults(page);
44                        });
45                    });
46                }
47            })
48            .catch(error => console.error('AJAX error:', error))
49            .finally(() => {
50                // Hide the spinner
51                document.getElementById('pmpro-ajax-spinner').style.display = 'none';
52            });
53    }
54    
55    if (searchForm) {
56        searchForm.addEventListener('submit', function (e) {
57            e.preventDefault();
58            fetchResults();
59        });
60    }
61	form.addEventListener('change', () => fetchResults(1));
62	fetchResults(); // Initial load
63});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.