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
495 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.

Related Questions In Web Development

0 votes
1 answer

How to Return JSON from PHP to JavaScript?

Hello @kartik, Php has an inbuilt JSON Serialising ...READ MORE

answered Jul 6, 2020 in Web Development by Niroj
• 82,840 points
1,657 views
0 votes
0 answers

How to filter JSON Data in JavaScript or jQuery?

How to filter JSON data using Javascript ...READ MORE

Jul 1, 2022 in Web Development by rajatha
• 7,680 points
2,478 views
0 votes
0 answers

How to get mobile number from facebook login using jquery?

I am trying to work facebook login ...READ MORE

Jul 19, 2022 in Web Development by gaurav
• 23,260 points
811 views
0 votes
1 answer

How to change the jquery mobile flip switch state from code

I've examined the page you posted and ...READ MORE

answered Aug 1, 2022 in Web Development by rajatha
• 7,680 points
713 views
0 votes
0 answers

How to accses to laravel if-else variable with jquery

I have a dating project. We are ...READ MORE

Aug 8, 2022 in Web Development by gaurav
• 23,260 points
1,225 views
0 votes
0 answers

How to obtain data from random wikipedia page with jquery

$(".wikiResult h3").load("https://en.wikipedia.org/wiki/Special:Random #firstHeading i"); I would like to ...READ MORE

Aug 11, 2022 in Web Development by gaurav
• 23,260 points
517 views
0 votes
1 answer

How can I print variable and string on same line in Python?

Use , to separate strings and variables while printing: print ...READ MORE

answered Sep 17, 2018 in Python by Priyaj
• 58,020 points
3,515 views
0 votes
1 answer

comparing strings in Python using "==" or "is"

is is used for identity testing and ...READ MORE

answered Sep 19, 2018 in Python by SDeb
• 13,300 points
840 views
+1 vote
1 answer

Python: Print variable and string in same line

For a better understanding you can refer ...READ MORE

answered Oct 30, 2018 in Python by Priyaj
• 58,020 points
1,531 views
0 votes
1 answer

TypeError: $.ajax(...) is not a function?

Please double-check if you're using the full-version ...READ MORE

answered Feb 22, 2022 in Others by Aditya
• 7,680 points
6,943 views
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