|Posted: Monday Apr 15th, 2013 at 9:27 am #47493|
I have coupon codes that allow for 100% discount on membership. As s2Member doesn’t currently support this, I’ve elected to load the s2 shortcode in via ajax after validation. Something like this:
When a visitor types in a coupon into the input and clicks Validate, an ajax call is made, which validates/rejects their coupon. If the coupon is valid, the php does something like this:
This is all workng fine until it gets to the reCaptcha – the recaptcha form will not show up! The form says “Security Code” with a horizontal rule below it, but the reCaptcha input never appears.
Another weird thing is that after the form is appended to the document, I can see a get request made to https://www.google.com/recaptcha/api/challenge?k=xxx&_=xxx (where xxx’s are replaced by long sequences of digits) with a correct looking response (a RecaptchaState object with correct looking properties).
I don’t see a single error at any point in Chrome’s console.
Attempting to submit the form as-is results in a post to /wp-admin/admin-ajax.php, with the screen showing a white screen with a ‘0’ (rejected/bad ajax call?).
Updated to include comment of mine below (can’t seem to delete it).
The form submits to /wp-admin/admin-ajax.php, but I cannot figure out what action/function it uses to process the submitted data. Perhaps the problem is that the ajax function has not been registered with WordPress when I am dynamically inserting the shortcode?
- s2Member® Products