mistergonza
6/3/2015 - 6:07 PM

Ajax sending a form using jquery

Ajax sending a form using jquery

$.ajax({
    url:     $("#"+form_id).attr("action"),
    type:     "POST",
    dataType: "html",
    data: $("#"+form_id).serialize(),
    success: function(response) { //if ok
        $("#form_result").html(response);
    },
    error: function(response) { //if error
        $("#form_result").html("Error");
    }
});