“JQuery Post” Code-Antworten

JQuery Post JSON Beispiel

<script type="text/javascript">
    function send() {
        var person = {
            name: $("#id-name").val(),
            address:$("#id-address").val(),
            phone:$("#id-phone").val()
        }

        $('#target').html('sending..');

        $.ajax({
            url: '/test/PersonSubmit',
            type: 'post',
            dataType: 'json',
            contentType: 'application/json',
            success: function (data) {
                $('#target').html(data.msg);
            },
            data: JSON.stringify(person)
        });
    }
</script>
Annoying Ape

JQuery Post

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

Post Anfrage 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

JQuery Post

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

Machen Sie Ajax Anfrage Post JQuery

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

Better Bison

$ post in jQuery


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

Delightful Deer

Ähnliche Antworten wie “JQuery Post”

Fragen ähnlich wie “JQuery Post”

Weitere verwandte Antworten zu “JQuery Post” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen