I have an audio player on my site, so I cannot page refresh.
I am using ajax to dynamically load the content.
I have set up the google custom search, however, I cannot figure out how I would go about loading the results without a page refresh.
My code for dynamically loading content works like this.
When a link(href) is clicked, I trigger a hash change, then return false to prevent the default behaviour.
// Trigger Hash Change
let page = $(this).attr("href");
window.location.hash = page;Then I have another function that detects a hash change and will load the appropriate content.
$(window).bind('hashchange', function () {
let newHash = window.location.hash.substring(1);
$("#main-content").load(newHash + " #ajax-content", function (responseTxt, statusTxt, xhr) {
}).hide().fadeIn();
});The content of my search page is set up like this
then for the search form I have not changed anything
