Last active
September 15, 2019 18:20
-
-
Save blzbruno/6dd2a8877c61f2335ddea3fb5866836c to your computer and use it in GitHub Desktop.
Mautic Ajax Submit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendMautic() { | |
var name = $("#name").val(); | |
var email = $("#email").val(); | |
var whatsapp = $("#whatsapp").val(); | |
$.ajax({ | |
url: "https://domain.com.br/form/submit?formId=XX", | |
type: "post", | |
enctype: 'multipart/form-data', | |
headers: {'X-Requested-With': 'XMLHttpRequest'}, | |
data: { "mauticform":{ | |
name : name, | |
email : email, | |
whatsapp :whatsapp, | |
return : "", | |
formId : XX, | |
formName : "formname", | |
submit : "" | |
}} , | |
success: function (response) { | |
console.log("Data: " + response); | |
// You will get response from your PHP page (what you echo or print) | |
}, | |
error: function(jqXHR, textStatus, errorThrown) { | |
console.log(textStatus, errorThrown); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment