Possible Duplicate:
in javascript is it possible to construct an object literal with expressions evaluating to strings for property names?
I am having a problem setting object keys and values from variables, if I set just the key or just the value from a variable it works fine if I set them both from variables it does not work.
This works fine
$(":input").change(function () {
var currentId = $(this).attr('id');
var currentval = $(this).attr('value');
$.post("/inside/update.php", {
"profile_age":currentval
});
});
This configuration does not work
$(":input").change(function () {
var currentId = $(this).attr('id');
var currentval = $(this).attr('value');
$.post("/inside/update.php", {
currentId:currentval
});
});