I've a function like this:
function flush_changes() {
jQuery('#save-changes').replaceWith('<span id="save-changes">Saving..</span>');
var changes = new Array();
for (var i=0; i<edited_users.length; i++) {
changes.push({
id: edited_users[i],
first_profession: jQuery('#user_first_profession_' + edited_users[i]).val(),
second_profession: jQuery('#user_second_profession_' + edited_users[i]).val()
});
}
jQuery.post("${tg.url('/users/admin_user_professions/save')}",
{
changed_users: changes,
num_of_changed_users: changes.length
},
function(data) {
if (data.result == 'OK') {
location.href = location.href;
} else {
alert('Error while saving: ' + data.reason);
}
}, 'json');
}
When it gets called, if i run the application from localhost i can see my data sent correctly, while when i run the application on my production server i see (using the webkit inspector) the data passed as follows:
changed_users:[object Object] num_of_changed_users:1
Why on production server i get "object Object"? The jQuery library is the same on the two environments.
Thanks in advance!
EDIT Here is the output on the inspector on localhost
changed_users%5B0%5D%5Bid%5D:314 changed_users%5B0%5D%5Bfirst_profession%5D:5 changed_users%5B0%5D%5Bsecond_profession%5D:6 num_of_changed_users:1