Ajax working as intended
This commit is contained in:
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user