Ajax Call before sending messsge
-
Good day,
I’m working on a project and I’d like to save all the entries in the database, I want to create a custom post type where the user entries can be saved. But I’d like to know if there is a way I can prevent the contact form from sending the message until there is a success message from the Ajax call.I know you recommend flamingo for saving entries into the database but I’d like to create this custom CPT for saving the entries as I’m planning to make the location of the CPT easily accessible for the client and some other custom setup as per the client requirements
I can work with Ajax in WordPress, I just need to know how to present the contact form from sending message and when all checks out (I.E verification and CPT has been updated), the CF7 can send user’s message and give user’s the appropriate CF7 response
I don’t know if CF7 uses something like this;
<?php //if all Ajax checks out and updated CPT; echo '1'; //response else echo '0'; //response if CPT is not updated Die;
Then in the jQuery file that receives response
If response is '1', then send the message and give a success message (I don't know if CF7 has something like WPCF7->send_mail ) and if response is '0', which means the CPT wasn't updated for some reason, message will not be sent and user Wil receive the CF7 error message
I have basic knowledge of what I want to do but not sure how or the right way to go about it. Please help
- The topic ‘Ajax Call before sending messsge’ is closed to new replies.