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, … }).

Free Live Chat for Any Issue

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

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.

Rate this post