Skip to content

Instantly share code, notes, and snippets.

@rwkyyy
Created October 26, 2018 18:21
Show Gist options
  • Save rwkyyy/88fe965f8815b381615208657b458b4b to your computer and use it in GitHub Desktop.
Save rwkyyy/88fe965f8815b381615208657b458b4b to your computer and use it in GitHub Desktop.
cf7 dom event + jquery.post for sending data to external api via URL
document.addEventListener( 'wpcf7mailsent', function( event ) {
var name = jQuery("input[name=your-name]").val();
var email = jQuery("input[name=your-email]").val();
var phone = jQuery("input[name=tel-151]").val();
var date = jQuery("input[name=date-146]").val();
var msg = jQuery("textarea[name=your-message]").val();
jQuery.post ('http:/url.tld?' + 'username=static_value' + '&password=static_value' + '&source=static_value' + '&clientName=' + name + '&clientEmail=' + email + '&clientPhone=' + phone + '&programmingDate=' + date + '&message=' + msg );}, false );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment