PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Loading GForms via jquery .load() prevents ajax submit from working correctly

  1. Hi there!

    I guess my title says it all. Just read it once more. Its all in there :) And it also makes sense. After having googled extensively i discovered that .load() won´t load in the respective javascript and thus content using javascript won´t work in the new environment (e.g. the div where i loaded my form in).

    Anyhow, just to give you a more specific idea of my situation: I have a post with my form (embedded by shortcore). I am loading this post dynamically into my page. Everything works, HTML, CSS, and even the AJAX submission. Yes it works, (I actually get a post uplaoded), but it won´t reload nor do anything once the upload is done, leaving my users with still the form in front of them.

    NOW MY QUESTION: :)

    Is there a javascript function call I can trigger after .load() (or in the load callback) in order to give my newly loaded form all the javascript bits it needs, to correctly perform its ajax submit? And if yes, which one?

    That said, thanks ahead for any hint or help!!!

    Hope we can get this working, I am sure it will be interesting for others as well.

    regards,

    kubante

    Posted 10 years ago on Friday July 27, 2012 | Permalink
  2. Will any of these JavaScript related events help you? I'm not exactly certain what you're trying to do or where the pitfalls lie.

    http://www.gravityhelp.com/documentation/page/Developer_Docs#Javascript

    Posted 10 years ago on Sunday July 29, 2012 | Permalink
  3. Hey ! thanks for your reply. Actually your hint put me on the right track. In the end I managed to do it following the concept described here:

    http://wp.tutsplus.com/tutorials/getting-loopy-ajax-powered-loops-with-jquery-and-wordpress/

    Basically, if you want to insert posts (of course also posts that include forms) dynamically (and you want every bit of the post / form working, including its javascripts), you need to build an own wp_query and include it via a basic ajax request that looks more or less like this:

    $.ajax({
                    type       : "GET",
                    data       : {numPosts : 1, pageNumber: page},
                    dataType   : "html",
                    url        : "http://WWW.YOURSITE.COM/wp-content/themes/YOUR_THEME_NAME/loopHandler.php",

    Hope this helps,

    regards,

    kubante

    Posted 10 years ago on Tuesday July 31, 2012 | Permalink
  4. Thank you for extending on the little assistance I provided. Glad you got that working.

    Posted 10 years ago on Tuesday July 31, 2012 | Permalink