I have an Object inside AJAX call and I'm not able to add new property to its property containing another object.
Here is my attempt:
$.post('/home/save.json', {obj:obj}, function(data) {
var qu = {};
qu["Id"] = "some value";
qu["Type"] = "some value";
qu["Name"] = "some value"
qu["Variants"] = data["Variants"]
if (data['Subvariant']) {
qu["Variants"]["Subvariant"] = data['Subvariant']
}
// ...
});
data["Variants"]is actually an object? What does the relevant part of your data (the JSON) look like? What you have will work as long asdata["Variants"]is an object.