“JQuery Ajax Type Json” Kode Jawaban

cara mengatur json type jQuery jax

$.ajax({
    type: "POST",
    contentType: "application/json",
    url: 'http://localhost:16329/Hello',
    data: { name: 'norm' },
    dataType: "json"
});
Obedient Osprey

JQuery Ajax Type Json

$.ajax('/jquery/submitData', {
    type: 'POST',  // http method
    data: { myData: 'This is my data.' },  // data to submit
  	dataType: 'json',
    success: function (data, status, xhr) {
        $('p').append('status: ' + status + ', data: ' + data);
    },
    error: function (jqXhr, textStatus, errorMessage) {
            $('p').append('Error' + errorMessage);
    }
});
Tosindo

cara mengatur json type jQuery jax

        $.ajax({
            type: "POST",
            url: siteRoot + "api/SpaceGame/AddPlayer",
            async: false,
            data: JSON.stringify({ Name: playersShip.name, Credits: playersShip.credits }),
            contentType: "application/json",
            complete: function (data) {
            console.log(data);
            wait = false;
        }
    });
Obedient Osprey

JQuery Ajax saat gagal

fail: function(xhr, textStatus, errorThrown){
	alert('request failed');
}
Andrew Lautenbach

Jawaban yang mirip dengan “JQuery Ajax Type Json”

Pertanyaan yang mirip dengan “JQuery Ajax Type Json”

Lebih banyak jawaban terkait untuk “JQuery Ajax Type Json” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya