I have the following code
$.post(
"/factory/set",{
key : value
},
function(response) {
});
}, "json"
);
where
key = "foo"
value = "bar"
but the server always gets “key” and “bar”, is there a way to set the key as variable, not string?
Create an object:
Then set the property:
Then use the object in your call to
$.post():