JS after AJAX


  • QA Engineer

    In the project being developed, WP uses Search Filter Pro to search for arbitrary types of post and taxonomy.

    Reference to the example http://tour.ananas.net.ua/cms/sample-page/

    There's a code on the top of every record that lifts a black plate up. Plagina's friends with ajax. After the withdrawal of the request, JS does not naturally sign.

    The developer foresaw AJAX launch detection and crypt loading:

    `//detects the start of an ajax request being made
    $(document).on("sf:ajaxstart", ".searchandfilter", function(){
      console.log("ajax start");
    });
    

    //detects when the ajax request has finished and the content has been updated
    // - add scripts that apply to your results here
    $(document).on("sf:ajaxfinish", ".searchandfilter", function(){
    console.log("ajax complete");
    //so load your lightbox or JS scripts here again
    });

    //an event fired when S&F is initialised and S&F scripts have been loaded
    $(document).on("sf:init", ".searchandfilter", function(){
    console.log("S&F JS initialised");
    });`

    I'm using the version of the flame 1.4.3, and I don't have that decision.
    Who's faced this problem?



  • Decision submitted on the author ' s website http://www.designsandcode.com/wordpress-plugins/search-filter-pro/faqs/

    I should have just turned into an anonymous function:

        (function ($) {
    
    "use strict";
    
    $(function () {
        $(document).on("sf:ajaxstart", ".searchandfilter", function () {
            console.log("ajax start");
        });
        $(document).on("sf:ajaxfinish", ".searchandfilter", function () {
            console.log("ajax complete");
    
        });
        $(document).on("sf:init", ".searchandfilter", function () {
            console.log("S&F JS initialised");
        });
    });
    

    }(jQuery));




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2