I am using jQuery 1.7.1. and I have the following question/problem:
The code has as follows:
var accountObject = new Object();
accountObject.account = new Object();
accountObject.account.sas = [];
$.ajax({
type: "PUT",
url: "/a/2",
data: accountObject,
dataType: "html",
success: function(msg) {
alert_user("Successfully saved the selected session attributes as defaults");
},
error: function(msg) {
alert_user(msg);
}
});
The problem is that, due to the fact that I set accountObject.account.sas
to an empty array, the data
arrives completely empty at the server, as:
{}
where it should have been:
{ "account": { "sas": [] } }
When I put some entries in the sas
property of account
then everything is ok. For example, if I put the string "1", "2" and "3" as an array ["1", "2", "3"]
then I get on the server:
{ "account": { "sas": [ "1", "2", "3" ] } }
Does anybody know why this is so?
Thanks in advance Panayotis