Skip to content

Fix ReferenceError: target is not defined in loadMoreUpcomingEvents#2126

Open
oduppinsjr wants to merge 1 commit intowpeventmanager:masterfrom
oduppinsjr:loader-fix
Open

Fix ReferenceError: target is not defined in loadMoreUpcomingEvents#2126
oduppinsjr wants to merge 1 commit intowpeventmanager:masterfrom
oduppinsjr:loader-fix

Conversation

@oduppinsjr
Copy link
Copy Markdown

@oduppinsjr oduppinsjr commented Apr 17, 2026

Summary

Fixes a JavaScript \ReferenceError: target is not defined\ when using the upcoming events shortcode with Load more pagination.

Root cause

\loadMoreUpcomingEvents\ referenced \ arget\ in the AJAX success handler (copied from \getEventListings), but \ arget\ is never defined in that function.

What changed

Use a jQuery lookup on #upcoming_event_listing\ and the loader (#load_more_events_loader\ / .load_more_events_loader) to clear \wpem-loading\ without throwing.

Files

  • \�ssets/js/event-ajax-filters.js\
  • \�ssets/js/event-ajax-filters.min.js\

Fixes a JavaScript `ReferenceError: target is not defined` when using the upcoming events shortcode with "Load more" pagination.

### Steps to reproduce
1. Use the upcoming events shortcode with load-more (not full pagination).
2. Click "Load more listings" after the first page loads.
3. Browser console shows: `Uncaught ReferenceError: target is not defined` in `event-ajax-filters(.min).js` in the AJAX `success` callback for upcoming listings.

### Root cause
`loadMoreUpcomingEvents` used `target` in the success handler (copied from `getEventListings`), but `target` is never defined in that function.

### What changed
Replaced the invalid `target` reference with a scoped jQuery lookup on `#upcoming_event_listing` and the loader element (`#load_more_events_loader` / `.load_more_events_loader`) so the loading state is cleared without throwing.

### Files
- `assets/js/event-ajax-filters.js`
- `assets/js/event-ajax-filters.min.js`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant