“JQUERY POST” Ответ

jquery post json пример

<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

Разместите запрос 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

Сделайте Ajax запрос 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

Ответы похожие на “JQUERY POST”

Вопросы похожие на “JQUERY POST”

Больше похожих ответов на “JQUERY POST” по JavaScript

Смотреть популярные ответы по языку

Смотреть другие языки программирования