Last active
May 22, 2018 09:35
-
-
Save zilahir/ee0c4bf482b1571b8c34eb2c91146d12 to your computer and use it in GitHub Desktop.
process the form
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
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