@eglobal/sendform

This simple JQuery plugin has the function of serializing into a json object and sending an html form to a url

Usage no npm install needed!

<script type="module">
  import eglobalSendform from 'https://cdn.skypack.dev/@eglobal/sendform';
</script>

README

Send Form Ajax

This simple JQuery plugin has the function of serializing into a json object and sending an html form to a url

Sample

$(function(){
    $('#form').sendForm({
        fields: [
            'input',
            'textarea',
            'select'
        ],
        url: 'api.php',
        done: function(response){ 
            $('#response').html(`<pre>${response}</pre>`)
        },
        fail: function(response){ console.log(response);},
        always: function(response){ console.log(response);},
    });
});