Is there any solution to detecting if a POST have been sent with jQuery?
My situation is that I have a WP-plugin (Contact form 7) which is sending the data through a jQuery ajax-function. When the form is filled right (validates) the user should be sent to page X.
I have tried with the following without any good results:
if ($(".wpcf7-mail-sent-ok").is(":visible")){
window.location.href = "http://stackoverflow.com";
});
I think this doesn’t work because the class “wpcf7-mail-sent-ok” is showing up only when the form is sent and valid by jQuery. So it isn’t there to be “detected” for my above code.
How do I solve this issue?
You can detect DOM insertions with
DOMNodeInsertedevent. If you thinkwpcf7-mail-sent-okis being inserted only after the ajax call then you can bind on this event.