Reply To: Reinitialize plugin after AJAX loading form page.

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Reinitialize plugin after AJAX loading form page. Reply To: Reinitialize plugin after AJAX loading form page.



Thank you for your reply, I appreciate the suggestion!

Your suggestion does technically work – though I'll offer my thoughts on this for future reference and explain:
I don't think it should be used as a long-term solution since it could be so easily broken. Any setting changes or plugin updates could break it easily. However, in the short-term, I've set up the relevant code like this:

I added a new JS file with a simple function containing the plugin call and parameters

initASPconfig = function() {
  var homeUrl = location.protocol + '//' + + '/';
    homeurl: homeUrl,
} // END initASPconfig

And then in the navigation.js AJAX success callback, I just call that function:

pageContent.load(URL + ' #page-content > *', function() {

This does work, the plugin does reinitialize after the AJAX loading the search page this way. Like I said previously though, I not a huge fan of how fragile this code is. So it makes me wonder if there wouldn't be a way to wrap the plugin's initialization code into it's own separate function, and then bind that function to the window ready event, and still leave the initialization function available to be called again later. I can't say for sure without some doing some rewriting and testing, but for now thanks again for your help with this issue. I appreciate it!