Automattic / Automattic/jetpack

Contact Form: Error sending via ajax

Open
#10,882 1 comment 0 reactions 0 assignees View on GitHub
[Feature] Forms [Pri] Low Enhancement Good For Community
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

I'm trying to send the form via ajax to the "admin-ajax.php", but gives the error "An error occurred. Please try again later".
I concluded that the code stops at line 2384 of "grunion-contact-form.php". There is a condition: ($ post-> ID! = $ _POST ['contact-form-id']), which results in TRUE, then "return false" is triggered, not completing the send.
The "$post" of the above condition refers to the global variable, but it does not exist in ajax requests by "admin-ajax.php". This must be corrected.

Contributor guide

Open the contributing guide

Research direction

Start in grunion-contact-form.php around line 2384 and trace the admin-ajax.php request path described in the report. Verify how the post data and contact-form-id are handled during an AJAX submission. Done means the form sends successfully through AJAX without triggering the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.