Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

send sharepoint list form data to another server api as JSON with onsubmit

$
0
0

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


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>