I am passing this function different field names on each call. I would like it to post the interpolated string value of the variable field
as the name of the posted var. Eg one post might have
data: { 'shoppingCartContents' : cartrow, 'number' : number, 'foo' : value }
but every post just has
data: { 'shoppingCartContents' : cartrow, 'number' : number, 'field' : value }
even though field
is not in quotes.
function update_personalization(cartrow, number, field, value) {
$.ajax({
type: 'POST',
url: 'updatePersonalization.php',
data: { 'shoppingCartContents' : cartrow, 'number' : number, field : value }
});
}
What am I doing wrong?
Thanks!
JG