1$.ajax({
2 type: "POST",
3 contentType: "application/json",
4 url: 'http://localhost:16329/Hello',
5 data: { name: 'norm' },
6 dataType: "json"
7});
1$.ajax('/jquery/submitData', {
2 type: 'POST', // http method
3 data: { myData: 'This is my data.' }, // data to submit
4 dataType: 'json',
5 success: function (data, status, xhr) {
6 $('p').append('status: ' + status + ', data: ' + data);
7 },
8 error: function (jqXhr, textStatus, errorMessage) {
9 $('p').append('Error' + errorMessage);
10 }
11});
1$.ajax({
2 method: "POST",
3 url: "some.php",
4 dataType: "json",
5 data: {}
6}).done(json => console.log(json));
7
1 $.ajax({
2 type: "POST",
3 url: siteRoot + "api/SpaceGame/AddPlayer",
4 async: false,
5 data: JSON.stringify({ Name: playersShip.name, Credits: playersShip.credits }),
6 contentType: "application/json",
7 complete: function (data) {
8 console.log(data);
9 wait = false;
10 }
11 });