Ajax working as intended

This commit is contained in:
2021-02-15 13:39:56 +01:00
parent 5a211c654e
commit 1da7645519
2 changed files with 15 additions and 13 deletions

View File

@@ -49,37 +49,38 @@ function getCookie(cname) {
function updateData(){
var updatedJson = generateJson();
$.ajax({
var request = $.ajax({
url: 'http://localhost:8097/mock/json',
type: 'PUT',
data: JSON.stringify(updatedJson, null, 2),
error: function(e) {
console.log(e);
},
dataType: "json",
contentType: "application/json",
success: getData(),
});
getData();
request.done(function () {
getData();
});
}
function addMessage(){
$.ajax({
var request = $.ajax({
url: 'http://localhost:8097/mock/json/'+clientUUID,
type: 'POST',
success: getData(),
});
getData();
request.done(function () {
getData();
});
}
function removeTile(id){
var jsonObject = findJsonById(id);
$.ajax({
var request = $.ajax({
url: 'http://localhost:8097/mock/json/'+clientUUID + '/' + id,
type: 'DELETE',
success: getData(),
});
getData();
request.done(function () {
getData();
});
}