“Posting permintaan jQuery” Kode Jawaban

Posting jQuery

$.post( "test.php", { name: "John", time: "2pm" })
  .done(function( data ) {
    alert( "Data Loaded: " + data );
  });
Glamorous Goat

Posting permintaan jQuery

 /* Get from elements values */
 var values = $(this).serialize();

 $.ajax({
        url: "test.php",
        type: "post",
        data: values ,
        success: function (response) {

           // You will get response from your PHP page (what you echo or print)
        },
        error: function(jqXHR, textStatus, errorThrown) {
           console.log(textStatus, errorThrown);
        }
    });
Breakable Bison

Posting jQuery

$.post("demo.php",{id:1})
  .done(function(data) { console.log(data) })
  .fail(function() { console.error("Error") })
ProfCode

membuat jax permintaan post jQuery

$.ajax({
  method: "POST",
  url: "some.php",
  data: { name: "John", location: "Boston" }
})

Better Bison

$ pos di jQuery


$.ajax({
    method: "POST",
    url: "some.php",
    data: { name: "John", location: "Boston" }
}).done(function( msg ) {
    alert( "Data Saved: " + msg );
});

Delightful Deer

$ pos di jQuery

$(function(){
    $('#myForm').on('submit', function(e){
      e.preventDefault();
      $.post('http://www.somewhere.com/path/to/post', 
         $('#myForm').serialize(), 
         function(data, status, xhr){
           // do something here with response;
         });
    });
});
Friendly Ferret

Jawaban yang mirip dengan “Posting permintaan jQuery”

Pertanyaan yang mirip dengan “Posting permintaan jQuery”

Lebih banyak jawaban terkait untuk “Posting permintaan jQuery” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya