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 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 });
1 $.ajax({
2
3 url : "file.php",
4 method : "POST",
5
6 data: {
7 //key : value
8 action : action ,
9 key_1 : value_key_1,
10 key_2 : value_key_2
11 }
12 })
13
14 .fail(function() { return false; })
15 // Appel OK
16 .done(function(data) {
17
18 console.log(data);
19
20 });