尝试此脚本
document.addEventListener( 'wpcf7mailsent', function( event ) {
var inputs = event.detail.inputs;
if ( '1286' == event.detail.contactFormId ) {
var fullname = document.getElementById('very-special-field').value;
var msisdn = document.getElementById('mobile-number').value;
var username = document.getElementById('username').value;
var email = document.getElementById('email').value;
var company = document.getElementById('company').value;
var account_type_id = document.getElementById('account_type_id').value;
form_data = {
fullname,
msisdn,
username,
email,
company,
account_type_id
};
jQuery.ajax({
type: "POST",
url: 'http://myurl.com',
data: JSON.stringify(form_data),
success: function(data) {
console.log(data);
},
error: function(data) {
console.log(data);
},
dataType: 'json'
});
alert('hi');
console.log(form_data);
}
}, false );