Skip to content

Instantly share code, notes, and snippets.

@blzbruno
Last active September 15, 2019 18:20
Show Gist options
  • Save blzbruno/6dd2a8877c61f2335ddea3fb5866836c to your computer and use it in GitHub Desktop.
Save blzbruno/6dd2a8877c61f2335ddea3fb5866836c to your computer and use it in GitHub Desktop.
Mautic Ajax Submit
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