I have question with two options. If user select option 1 then I would like to redirect to URL1 and if user select option 2 then I would like to redirect to URL2.
How can I do that?
Please see attached screenshot.
JSON code is here. I am using HTML to show the question.
Option input element has value attribute to hold any value connected to that input and name attribute to group different inputs. When you have it you can access value like so:
What do you mean by you’re creating it with JSON? This is same question as @MathisBarre. JSON is a text format used to pass data around – eg you request some data over a network, you get it in JSON format, you decode that to JavaScript, then you have a JavaScript object and that’s the thing you work with. You can’t use that JSON object directly, for you to be using it it must be a JavaScript object, not a text string, and in which case you can just use normal JS methods to push values into the array.