{
"nodesA": [
{
"id": "A0",
"label": "A0",
"category": "0"
},
{
"id": "A1",
"label": "A1",
"category": "1"
}
],
"nodesB": [
{
"id": "B0",
"category": "0",
"x": 15,
"y": 15
},
{
"id": "B1",
"category": "1",
"x": 85,
"y": 85
}
]
}
Это мой json.db. Мне нужно обновить координаты узлов B при вызове ajax. Как я могу сделать это с помощью PATCH / PUT на AJAX. Следующий код дает мне ошибку. Temp имеет точно такой же формат, который мне нужен.
nodesB:[{id: "B0", category: "0", x: 0, y: -20},
{id: "B1", category: "1", x: 90, y: -20}]
$.ajax({
type: "PATCH",
url: "js/json/dndDataSample.json",
data : JSON.stringify(temp),
processData: false,
contentType: 'application/json ; charset=utf-8',
dataType: "json",
success: function(result) { alert(result) },
error : function(textStatus, errorThrown) {
console.log("The following error occured: " + textStatus, errorThrown);
},
});