• Resolved Shopix Romania

    (@shopixro)


    I have checked Ajax submission in settings. However, this is not working and the page will get reloaded but users will be added to subscription list.

Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter Shopix Romania

    (@shopixro)

    Hi Freddie,

    Not sure I understand what that means or how it is done.
    Perhaps you could help me out with a few more details?

    Thank you!

    Plugin Contributor Tracy Levesque

    (@liljimmi)

    ?????? YIKES, Inc. Co-Owner

    Hi @shopixro

    Teaching WordPress development is beyond the scope of free support.

    But here is a guide on how to enqueue scripts in WordPress:
    https://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/

    Best of luck,
    -Tracy

    Thread Starter Shopix Romania

    (@shopixro)

    Hi Tracy,

    Got it now, so manually enqueue the code directly into WP, not alter the plugin code to match that one.

    Thanks!

    Thread Starter Shopix Romania

    (@shopixro)

    Hi,

    I have figured out the problem eventually. The problem is arising from how the scripts and styles of the plugins are enqueued. This causes them to be enqueued before the jQuery dependency, thus failing.

    With hope that this will be taken into consideration for the future plugin versions, here are the changes made:

    First of all, I moved all enqueues in separate functions to use the recommended wp_enqueue_scripts hook instead of the wp_enqueue_script currently used by the plugin.
    Second of all, I added priority to all wp_enqueue_scripts hooks (in my case, 10).
    Third of all, I transferred inline css style to a file and enqueued it in the same method.

    I assume another option would be to check the jQuery dependency before enqueue or including jQuery if missing.

    Have a good day!

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Ajax submission not working’ is closed to new replies.