Skip to content

Instantly share code, notes, and snippets.

@zilahir
Last active May 22, 2018 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zilahir/ee0c4bf482b1571b8c34eb2c91146d12 to your computer and use it in GitHub Desktop.
Save zilahir/ee0c4bf482b1571b8c34eb2c91146d12 to your computer and use it in GitHub Desktop.
process the form
jQuery(function($) {
$(document).ready(function() {
const ajaxurl = '/contact';
$("#chili-contact-form").submit(function(e) {
e.preventDefault();
var messageObject = {
message: $("#message").val();
//invoke the firebase cloud function
$.ajax({
url : ajaxurl,
method : 'POST',
dataType: "json",
crossDomain: true,
data : {
contactobject: messageObject
},
success : function( response ) {
console.log(reponse);
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError);
}
});
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment