jquery ajaxform – AJAX form submit with jQuery

jquery ajaxform ajax() function is used for ajax call using jQuery. Syntax of jquery ajaxform $.ajax({name:value, name:value, … }).

jquery ajaxform – jQuery AJAX submit form Example

This is a simple example:

$("#contactFrm").submit(function(e) {

    e.preventDefault();

    var form = $(this);
    var actionUrl = form.attr('action');
    
    $.ajax({
        type: "POST",
        url: actionUrl,
        data: form.serialize(),
        success: function(data)
        {
          alert(data);
        }
    });
    
});

Method 1

$.get('ajax_data.php?' + $('#contactFrm').serialize())

$.post('ajax_data.php', $('#contactFrm').serialize())

Method 2 : With use of jQuery form plugin.

$("#contactFrm").ajaxForm({url: 'ajax_data.php', type: 'post'})

Send immediately:

$("#contactFrm").ajaxSubmit({url: 'ajax_data.php', type: 'post'})

Don’t Miss : Jquery Ajax Form Submit Examples Using PHP

Also Read This ๐Ÿ‘‰   php countdown timer - How To Create a Countdown Timer?

I hope you get an idea about jquery ajaxform.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, donโ€™t forget to share.