“JQuery Ajax Form Form Kirimkan contoh” Kode Jawaban

Formulir JQuery Ajax Kirim

// jQuery ajax form submit example, runs when form is submitted
$("#myFormID").submit(function(e) {
    e.preventDefault(); // prevent actual form submit
    var form = $(this);
    var url = form.attr('action'); //get submit url [replace url here if desired]
    $.ajax({
         type: "POST",
         url: url,
         data: form.serialize(), // serializes form input
         success: function(data){
             console.log(data);
         }
    });
});
Grepper

Pengajuan formulir Ajax JQuery

$(function() {
  $('form.my_form').submit(function(event) {
    event.preventDefault(); // Prevent the form from submitting via the browser
    var form = $(this);
    $.ajax({
      type: form.attr('method'),
      url: form.attr('action'),
      data: form.serialize()
    }).done(function(data) {
      // Optionally alert the user of success here...
    }).fail(function(data) {
      // Optionally alert the user of an error here...
    });
  });
});
Vyas

Formulir jQuery Kirim Ajax

    $(document).on('click', '#save_province', function () {
        var a = $("#province").val(), b = $("#district").val(), c = getParameterByName('supplier_id');
        $.ajax({
            url: "postavshik_save.php",
            type: "POST",
            data: {
                province: a,
                district: b,
                supplier_id: c,
            },
            beforeSend: function () {
                $("#province").attr("disabled", !0), $("#district").attr("disabled", !0);
            },
            success: function (a) {
                alert("Post so`rov yuborildi javob olindi");
            }
        });
    });
Shadow

AJAX mengirimkan data formulir

<form id="contactForm1" action="/your_url" method="post">
    <!-- Form input fields here (do not forget your name attributes). -->
</form>

<script type="text/javascript">
    var frm = $('#contactForm1');

    frm.submit(function (e) {

        e.preventDefault();

        $.ajax({
            type: frm.attr('method'),
            url: frm.attr('action'),
            data: frm.serialize(),
            success: function (data) {
                console.log('Submission was successful.');
                console.log(data);
            },
            error: function (data) {
                console.log('An error occurred.');
                console.log(data);
            },
        });
    });
</script>
Uninterested Unicorn

JQuery Ajax Form Form Kirimkan contoh

$.ajax({
			    type: "POST",
			    url: "upload.php",
			    data: { name:name, mobile:mobile, address:address, city:city },		    
			    dataType: "json",
			    success: function(result){
			        			    }
			});
Black Bat

Kirim formulir AJAX

Ajax jquery form submit
Good Grouse

Jawaban yang mirip dengan “JQuery Ajax Form Form Kirimkan contoh”

Pertanyaan yang mirip dengan “JQuery Ajax Form Form Kirimkan contoh”

Lebih banyak jawaban terkait untuk “JQuery Ajax Form Form Kirimkan contoh” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya