T157 put request is send. 415 response format unaccepted

This commit is contained in:
2021-02-06 13:30:24 +01:00
parent f851dd5538
commit 53215798f7
5 changed files with 29 additions and 15 deletions

View File

@@ -23,6 +23,23 @@ function getData(uuid){
});
}
function updateData(){
var updatedJson = generateJson();
$.ajax({
url: 'http://localhost:8097/mock/json',
type: 'PUT',
data: updatedJson,
success: function(data) {
console.log('PUT request received 200');
}
});
// $.put('http://localhost:8097/mock/json', function(data){
//
// });
// console.log('PUT request sent');
getData();
}
function clearMock(){
fillStaticFields('','','','');
@@ -143,13 +160,9 @@ function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function saveChanges(){
convertTableToJson();
generateJson();
}
function generateJson(){
console.log("Save button click");
var newJson =
{
clientUUID: json[jsonIndex].clientUUID,
@@ -160,7 +173,8 @@ function generateJson(){
httpHeaders: {},
};
newJson['httpHeaders'] = convertTableToJson();
document.write(JSON.stringify(newJson, null, 2));
console.log(JSON.stringify(newJson, null, 2));
return newJson;
}
// $("table tr").eq(row).find("td").eq(i%2).append("<img src='"+dataJson[i].imagen+"' width='100'/>");