“jQuery Ajax Tipo JSON” Código de respuesta

Cómo establecer JSON Tipo jQuery Ajax

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

jQuery Ajax Tipo 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

Cómo establecer JSON Tipo jQuery Ajax

        $.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 en fallas

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

Respuestas similares a “jQuery Ajax Tipo JSON”

Preguntas similares a “jQuery Ajax Tipo JSON”

Más respuestas relacionadas con “jQuery Ajax Tipo JSON” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código