Send data also in another url
-
Hello, can I send data from all fields also to a php file? Every step has 1-4 fields. So I want the same data that send via email, send also to php file. Data that send to email are these:
Internet: [radio-internet]
Mobile: [radio-mobile]
Provider: [radio-provider]
Surname: [your-surname]
Name: [your-name]
Email: [your-email]
Phone: [your-phone]
Hours: [radio-hours]I’ve tried something like this but not works:
<script type=”text/javascript”>
document.addEventListener( ‘wpcf7submit’, function( event ) {
//Form
var inputs = event.detail.inputs;for ( var i = 0; i < inputs.length; i++ ) {
if ( ‘radio-internet’ == inputs[i].name && ‘radio-mobile’ == inputs[i].name && ‘radio-provider’ == inputs[i].name && ‘your-surname’ == inputs[i].name && ‘your-name’ == inputs[i].name && ‘your-email’ == inputs[i].name && ‘your-phone’ == inputs[i].name && ‘radio-hours’ == inputs[i].name ) {
jQuery.ajax({
url : ‘process.php’, // the url where we want to POST
type : ‘post’,
data : inputs,
success : function( response ){
console.log(response);
console.log(‘lead inserted’);
},
error : function(e1, e2, e3){
console.log(e1);
console.log(e2);
console.log(e3);
}
});
console.log( event.detail );
}}, false );
</script>Any help or suggestion?
- The topic ‘Send data also in another url’ is closed to new replies.