WordPress.org

Ready to get started?Download WordPress

Forums

Google Forms
Redirect breaks in a few ways with jQuery 1.8.2 (6 posts)

  1. boomstik
    Member
    Posted 1 year ago #

    Hi. Great plugin. I am using WP 3.5-beta2-22252, and just wanted to let you know that the redirect behaviour breaks in the following ways:
    (i strongly suspect jQuery 1.8.2 as the culprit here)

    - with style='ajax', the page never redirects. Console shows the following error:

    Uncaught Error: Syntax error, unrecognized expression: http://redirect_url

    - also, if I enqueue jQuery directly from Google's CDN, neither style='ajax' or style='redirect' works. it just fails, and the error is:

    Uncaught ReferenceError: jQuery is not defined
    . The error happens directly after jQuery(document).ready(function($) {. Other jQuery-based functions and plugins work fine.

    I'm working around for now by using the builtin jQuery and style=redirect, but just a heads-up for you for WP 3.5. I'd be glad to assist with crushing these bugs, except that my JS knowledge is almost non-existent. but do let me know if i can be of assistance.

    Cheers!

    http://wordpress.org/extend/plugins/wpgform/

  2. boomstik
    Member
    Posted 1 year ago #

    Actually, turns out not enqueueing Google's version of jQuery breaks other things on my site :\

    just letting you know. Since some people prefer to replace WordPress' version of jQuery with a CDN version. (in this case, both are v. 1.8.2, which is trés bizzarre.)

  3. boomstik
    Member
    Posted 1 year ago #

    ok, so it looks like things are working fine with built-in jQuery, but not when enqueued from Google. I would still get the "jQuery is not defined" message, until I added the following to wpgform-core.php:

    ...
    var $j = jQuery.noConflict();
    $j(document).ready(function($) {
    ...

    basically aliasing jQuery to $j... and then it all works using Google's jQuery, even using the ajax confirmation page.
    interestingly, I had to do this in my own scripts when NOT using Google's jquery.

    on a separate note: when using ajax to display confirmation page, it loads the entire contents of <head> into <body>.

  4. boomstik
    Member
    Posted 1 year ago #

    And yet again.
    things seem to be even simpler.
    jQuery needs to be loaded in the <head>, then your plugin works. modifications to your code are not necessary.

    Is there any way to get your plugin's js to load last? as it stands, it loads itself before jQuery if it's enqueued in the footer, and thus things break.

    Sorry for the confusion, i've been posting simultaneously with the troubleshooting. :)

  5. Mike Walsh
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry for not seeing this sooner, I've been offline most of the day.

    Looks like you've made a bunch of progress. I don't have 3.5 beta instal.led anywhere, I will have to update my Linux VM before I can update WordPress. I do most of my development using the current version of WordPress on my Windows VM.

    That said, I just moved the jQuery script to the footer in the last release because there were some problems with having it earlier. I am not sure why it would matter though as the script shouldn't run until the document is ready. I think I can change the priority of the wp_footer action so it runs after other things. There is no reason for it to run early.

    If you want to try a hack, change the priority of the add_action() call for wp_footer in wpgform-core.php. It may be a couple days before I can try it myself, I have a meeting on Tuesday I am prepping for.

    Mike

  6. Mike Walsh
    Member
    Plugin Author

    Posted 1 year ago #

    With the time change I was up early and had a chance to update my Linux VM and take a look at this. I cannot replicate what you're seeing. On my VM I am running:

    • CentOS 5.5
    • PHP 5.3.5
    • WordPress 3.5-beta2-22360
    • WordPress Google Form 0.45
    • Standard Twenty Ten theme

    I don't have anything else active and everything seems to behave as I expect and I am not getting any errors in the Web Developer Console.

    Could the newer beta build have fixed a couple of things you ran into?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.