This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: JS event on search results returned

Home Forums Product Support Forums Ajax Search Pro for WordPress Support JS event on search results returned Reply To: JS event on search results returned

#57007
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Yes – it is possible through the JS API 🙂

This is what you are looking for:

window.addEventListener("load", () => {
	document.querySelectorAll(".asp_main_container").forEach((el) => {
		el.addEventListener("asp_results_show", (event) => {
			// event.detail carries the arguments
			const [id, instance, phrase] = event.detail;
			console.log(id, instance, phrase);
		});
	});
});

I hope this helps!