if i write:
function myindex(name){
var cut_point = name.lastIndexOf('_')+1;
return name.substring(cut_point);
}
...
var ind = myindex(some_id);
var data_users = {};
var $data_users = $(data_users);
$data_users.prop('user_'+ind,{this.id:$(this).val()});
were this.id = ‘login'( from <\input type=”text” id=”login”> value=”<\?=$user->Login ?>”/>) it will be wrong. but i neeed:
data_users = {
user_3: {
login: Rocsana
}
}
for example, if I write so:
$data_users.prop(this.id,$(this).val());
then key setting correct:
data_users = {login: “Rocsana”}
but i need this in object ‘user_3’. please help.
p.s. I need to track every change in fields linked to the user, adding them (changes) in the object and then the changes I am sending ajax in php, using json. for example
data_users {user_3 {login: Rocsana, role: Admin, e-mail:
test@test.com}, user_2 {…}}
keys “login”, “role”, … identical to the fields of the table “Users”. it’s easier to make a database query “UPDATE”. just parse the object and received the names of the fields that need to update.
With what your asking, you dont need to use JQuery for the creation and addition of the your issue. Using native JS would be easier anyway. Example below…