I need some reactivity in vanila js. I solved the problem but ran into a problem. Simple example:
Why does it work correctly:
let data = {
'test': ()=>"some value"
}
$.ajax({
url: "/api/test",
dataType: "json",
type: 'post',
data: data,
success: function(data){
}});
and it doesn’t work:
let data = {}
Object.defineProperty(data,'test', {
get: () => "some test value"
}
$.ajax({
url: "/api/test",
dataType: "json",
type: 'post',
data: data,
success: function(data){
}});
}