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

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Reinitialize plugin after AJAX loading form page. #5987
    calej17calej17
    Participant

    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
    [code]initASPconfig = function() {
    var homeUrl = location.protocol + ‘//’ + location.host + ‘/’;

    aspjQuery("#ajaxsearchpro1_1").ajaxsearchpro({
    homeurl: homeUrl,


    } // END initASPconfig[/code]

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

    [code]pageContent.load(URL + ‘ #page-content > *’, function() {
    initASPconfig();


    });[/code]

    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!

Viewing 1 post (of 1 total)