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 in Web Development by gaurav
• 17,580 points
8 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,740 points
907 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 in Web Development by rajatha
• 7,040 points
12 views
0 votes
0 answers
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 in Web Development by rajatha
• 7,040 points
14 views
0 votes
0 answers

How to accses to laravel if-else variable with jquery

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

4 days ago in Web Development by gaurav
• 17,580 points
10 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

1 day ago in Web Development by gaurav
• 17,580 points
7 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,080 points
2,671 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
244 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,080 points
907 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 in Others by Aditya
• 7,300 points
465 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP