Announcement

Announcement Module
Collapse
No announcement yet.

Ajax code not executed any more for singlepage documentation

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ajax code not executed any more for singlepage documentation

    Hi !

    Since the upgrade to 2.5 I have a code in custom code and in ajax call which is not executed anymore. It's not executed in custom code because even single page load in ajax, and its not executed in ajax because single page do not fire the executeJSCodeOnAjaxCallDocPost event.

    I find out that adding these lines to theme.js fixed the problem :

    Code:
    if( execute_js_after_ajax_call_pg_doc == 1 ) {
        jQuery( document ).trigger( "executeJSCodeOnAjaxCallDocPost", { "post_id": doc_search[1], "nonce": doc_ajax_var.nonce } );
    }
    I added these line around line 259 of the file. Here is the full function :

    Code:
                // Ajax call
                jQuery.ajax({
                    type: "post",
                    url: doc_ajax_var.url,
                    data: { action: 'display-doc-post',
                            nonce: doc_ajax_var.nonce,
                            post_id: doc_search[1],
                          },
                    success: function(data, textStatus, XMLHttpRequest){
                            jQuery( "#single-post-container" ).html(data);
                            if( doc_catpage_active == 1 ) { jQuery("#list-manual").mCustomScrollbar("scrollTo", ".doc-active"); }
    
                            if( execute_js_after_ajax_call_pg_doc == 1 ) {
                                jQuery( document ).trigger( "executeJSCodeOnAjaxCallDocPost", { "post_id": doc_search[1], "nonce": doc_ajax_var.nonce } );
                            }
                    },
                    error: function(MLHttpRequest, textStatus, errorThrown){
                        //alert(textStatus); 
                    }
                });
    I'm really not sure this is a problem or intentional behavior. At least it fixed my problem and now my code is executed again. Can you please review the modification and tell me if I did it wrong or not ?

    Thanks !

  • #2
    Its working without any issue, looks like you forget to activate Trigger JavaScript Code, Can you please make sure the feature is ON.
    Attached Files
    Best Regards,

    Jabin Kadel
    Founder & CEO
    WpSmartApps.com

    Comment


    • #3
      Hi,

      Thanks for your answer.

      This setting is checked since the beginning and this is still not working properly. If I put a simple console.log in the script box, I can see it's called on page refresh (F5) but not when I click on a link in the documentation tree (content loaded via ajax). My simple console.log is not called (I can see it only once : on page refresh).

      Moreover when I hit F5, the script is executed before the content of the page is loaded via ajax (if I do a select with jquery on the content of my page, this is not working).

      The only way I found to interact with the content of my page is to listen for the event "executeJSCodeOnAjaxCallDocPost" but this event is not fired on singlepage, hence my modification to fire that event in the singlepage case and properly interact with my content.

      I can run some tests if you want me to.

      Comment


      • #4
        We will check this issue and solve it on our upcoming upgrade version 3.0, it will be great if you can provide more data this will help us enhance the feature.
        Best Regards,

        Jabin Kadel
        Founder & CEO
        WpSmartApps.com

        Comment


        • #5
          Hi Jabin,

          Sorry I was in vacations.

          I can provide any information you need, but I find my first post very clear to me (sorry if my English is not very good ). If you want more details please ask me more precisely.

          Thanks

          Comment


          • #6
            Hi Dubuscyr,

            I had already address this issue to my technical team. If found any it will be fixed on our new upcoming upgrade version and i found your english very good .. no worries we are looking it
            Best Regards,

            Jabin Kadel
            Founder & CEO
            WpSmartApps.com

            Comment

            Working...
            X