I have a requirement for a helpdesk sharepoint list form to write to the Sp list (OOTB functionality) AND send the form data as JSON to an API endpoint.
I know this needs to be done in js/jquery and this is my code. this example is just to test it and sends the json string to my email address :
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$('#form').on('submit', function(event){
var obj = $('form').serializeJSON();
$.ajax({
type: 'POST',
url: 'mailto:me@me.ca',
dataType: 'json',
data: JSON.stringify(obj),
contentType : 'application/json',
success: function(data) {
alert(data)
}
});
return false;
});
</script>
it doesnt send the info to the email address. i am not a js expert and any help would be appreciated. I thought this was a simple process.
Regards,
Luis