Thank you. Your solution was correct in the front end. The console logs are showing correct payload data being sent from the front-end. However, in the server, it is interpreting the enclosed (or nested) “data” differently in “update” (PUT Request).
The server logs shows it was interpreted like this.
Hi @keithmanilla,
I think this could happen for several reasons.
Can you please show me the exact code you use to write parameters of PUT request?
From your description it looks like you assign the value of the task parameter as a string and not as an object, i.e.:
return gantt.ajax.put({
url: server + entity + “/” + id,
data: {
id: data.id,
task: JSON.stringify(data)
}
});
please make sure you assign it like this instead:
return gantt.ajax.put({
url: server + entity + “/” + id,
data: JSON.stringify({
id: data.id,
task: data
})
});
Also you can try to add headers:{"Content-Type":"application/json"} to ajax request, like at this sample https://snippet.dhtmlx.com/f6c662a00 - you can see that the request parameters look correctly if you open browsers Network panel and move any task.
If this does not solve your problem please send me a snippet (demo) where I could reproduce the issue
Thanks a lot. The headers:{"Content-Type":"application/json"}, solved it. I actually followed your snippet. It was a missing header that made the server misinterpret the request package.
Thank you so much.
1 Like
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan