Support » Plugin: Contact Form 7 » After the 4.8 Update : No send message and Jquery Error

  • Hi there.

    i just updated the contact form 7 on my website.

    in the normal way:
    When we click the send button; ajax-loader changes to visible, plugin check the inputs(required ones) and if its filled send the message. if the required inputs not filled, show us some error messages.

    but after the update:
    when we click the send button: ajax-loader changes to visible, and doesnt work anything after that. no error, no required check, nothing:]

    there was an error message on js console:
    the message is:

    Failed to load resource: the server responded with a status of 404 (Not Found)
    jquery.js:4

    POST http://www.domain.com/wp-json/contact-form-7/v1/contact-forms/134/feedback 404 (Not Found)

    • This topic was modified 2 years, 11 months ago by Mehmet Baris. Reason: spell check
    • This topic was modified 2 years, 11 months ago by Mehmet Baris.
Viewing 13 replies - 61 through 73 (of 73 total)
  • I maintain a website with lifelong learning courses, and we use CF7 in various places. I updated from 4.7 to 4.9 a few days ago, and had the same issue of the forms all breaking.

    A bit of investigation turned up two problems:

    1) The nginx server our site is hosted on had a redirect rule set up that automatically added trailing slashes to all site URLs via a 301 redirect. This resulted in the new REST endpoint that CF7 uses as of v4.8 being redirected to a version with a trailing slash:

    /wp-json/contact-form-7/v1/contact-forms/[postID]/feedback
    redirected to
    /wp-json/contact-form-7/v1/contact-forms/[postID]/feedback/

    The version with the slash, of course, was not a registered REST endpoint, and 404ed, breaking the contact form. We changed our nginx configs so that the trailing slash was not added to any URLs containing wp-json.

    2) With that fixed, the contact form was still broken – the emails were sent, but the form never completed as far as users could tell, they just saw the spinny. It turned out an unrelated plugin of ours (in this case, WooCommerce LearnDash Integration) was doing some slightly broken stuff during REST API registration, which resulted in PHP errors being included in the AJAX return from REST, which of course were not valid JSON and broke the clientside plugin. Hacking that other plugin to fix the broken bit finally let our CF7 contact forms work correctly.

    The specifics may not help anyone, but my observation is that CF7 v4.8+ is not actually broken, but it *does* assume that your site’s REST API will be functional. There may be several things preventing that from actually working (for any plugin), but if this is the first plugin you have to actually use REST, as it was for us, you might not have realized it. The Network tab in Chrome Developer Tools is super helpful here – check out the calls against that ‘feedback’ endpoint when you try to submit the form, and see if there is a 404 or if the json response has junk in it. Fix those issues, and, at least for us, CF7 v4.9 works nicely.

    • This reply was modified 2 years, 8 months ago by birdev.

    @birdev thanks for sharing your in-depth discovery.

    For a nondeveloper like myself, it sounds pretty complex but I also run on nginx and from the looks of my Chrome Errors:

    /wp-json/contact-form-7/v1contact-form-7/v1/contact-forms/11749/refill Failed to load resource: the server responded with a status of 404 (Not Found)
    
    /wp-json/contact-form-7/v1contact-form-7/v1/contact-forms/11749/feedback Failed to load resource: the server responded with a status of 404 (Not Found)

    It looks like it could be the same issue I’m having. Hopefully the plugin author is following this thread and can create some sort of fix/check for this REST API problem.

    The curious thing in my case is that one of my forms works just fine. It’s only the other form that allows multiple recipients to be selected (using a dropdown menu, pipielines and a required selector) that is having the issue and not sending any emails. Is there anyway for me to check if my REST API is working?

    • This reply was modified 2 years, 8 months ago by Soprano.

    I have the same problem :
    Failed to load resource: the server responded with a status of 404 (Not Found) /wp-json/contact-form-7/v1/contact-forms/7/feedback

    My 11 website are affected … need a fix !

    • This reply was modified 2 years, 8 months ago by benoitfouc.

    the only fix is to go back to 4.7 version

    This is not a fix …
    And we also need to block the updates of this plugin for a long time ?

    add_filter( ‘wpcf7_load_js’, ‘__return_false’ );

    THX to @billbordallo for the tomporary fix… it’s works on contact form 7 4.9

    • This reply was modified 2 years, 8 months ago by shamanesk.

    this remains a temporary solution.

    Has this been fixed as of Version 4.9.1?

    Still not working for me. The console shows the error:
    http://mydomain/wp-json/contact-form-7/v1/contact-forms/70/feedback/ 404 (not found)
    Only works when I disable ajax sending (see my previous comment).

    • This reply was modified 2 years, 6 months ago by billbordallo.

    Hey Guys!
    I think I have found the cause of the problem and therefore the solution. Thanks to this thread.

    My .htaccess has a rule to force a trailing slash after all URLs. The rule is:

    # Force trailing slash
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ https://mysite.com.br/$1/ [L,R=301]

    So, as @mikele3 explained in the thread linked above, this redirection was forcing all URLs to have a “/” in the end, including the wp-json path, which is used by Contact Form 7 after the 4.8 upgrade.

    I just have to add an exception in .htaccess to not redirect the /wp-json path. The final snippet is:

    # Force trailing slash
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteCond %{REQUEST_URI} !^/wp-json
    RewriteRule ^(.*)$ https://mysite.com.br/$1/ [L,R=301]

    Now I have the version 4.9.1 and all the forms are sending through ajax without any issue.

    I hope this could help others with the same problem.

    • This reply was modified 2 years, 6 months ago by billbordallo.

    I spent a couple hours reviewing the issue and it looks that depending on the update process of the WordPress (for example HostMonster and BlueHost sometimes forces the updates) the .htaccess file is modified. Please review the .htaccess that is triggering the 500 HTTP error.

    Hi guys,
    I’ve been reading all it through. In my case I have:
    Wordpress 4.9
    contact form 4.9.1

    API rest is enabled

    Here is the url with the form
    https://subventions.fr/dossier-subventions/jeune-entreprise-innovante-jei/#dossier-jei

    Here is the wp-json url:
    https://subventions.fr/wp-json/contact-form-7/v1/contact-forms/12118/feedback/
    where i get the following message

    but i don’t get the internal error 500 displayed in the console as I don’t code.

    Any idea what to do?

    it came of the Contact Form 7 Email Validation 2.0 plugin on my end

Viewing 13 replies - 61 through 73 (of 73 total)
  • The topic ‘After the 4.8 Update : No send message and Jquery Error’ is closed to new replies.