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.
Hi!
The problem with re-initialization is that there is no automatical way of doing it, as it’s not possible to detect from an outside scope that there was an ajax request finished and if it should re-initialize the plugin or not.
The plugin initialization is bound to the window ready event, which cannot be triggered twice. That would have been a good solution though.
What you can do is to search for the initilaization script on the page. Keep in mind that it contains parameters, which are generated dynamically if you change the settings on the back end. So I suggest only implementing this once you are done configuring the plugin.
If you open the page source and look for something like:
jQuery(document).ready(function () {
jQuery("#ajaxsearchpro1_1").ajaxsearchpro({
homeurl: 'http://wp-dreams.com/demo/wp-ajax-search-pro/',
......
......
});
});
Its a long long code with lot’s of parameters there. What you can try to do is to put the inner part of this script into the success ajax handler function body, so your code should look something like:
$.ajax({
type: 'GET',
url: 'page-to-request.html',
success: function (data, textStatus, jqXHR) {
// Here is your code and stuff...
// Reinitialise ajax search pro, make sure the window.ready part is NOT here, only the inner part!
jQuery("#ajaxsearchpro1_1").ajaxsearchpro({
homeurl: 'http://wp-dreams.com/demo/wp-ajax-search-pro/',
......
......
});
}
});
I have no idea if this is going to work, but it’s definitely going to trigger something.
Best,Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
![](https://wp-dreams.com/assets/envato/comment-button-knowledgebase.png)
![](https://wp-dreams.com/assets/envato/comment-button-support.png)
![](https://wp-dreams.com/assets/envato/comment-button-facebook.png)
![](https://wp-dreams.com/assets/envato/comment-button-twitter.png)