jQuery JSON how to define key from variable

0 votes

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?

Jul 28, 2022 in Web Development by gaurav
• 23,260 points

edited 5 days ago 9 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP