Hi Team,
In survey creator wanted to bind choices of dropdown from web API, but API method is POST which required parameter as JSON body. Please help.
Question
T6240
Visible to All Users
Hello,
Usually the POST web API method is used to send data on server.
If you want to populate dropdown question choices using the
choicesByUrl
property, then no, this property sends the "GET" request only.You can fill choices from the POST request response using your custom code.
Thanks, Serge
SurveyJS Team
Hi Team,
Can i have some example how to fill choices from the POST request response using your custom code.
Hello,
It's simply:
question.choices = [1, 2, 3, 4, 5]; // where is that you get via the "POST" request
Here is the working sample - https://plnkr.co/edit/cYoawNqpeJWeK9nf . The "setTimeout" function emulates async call to a web service.
Thanks, Serge
SurveyJS Team
Hi Team,
I want to add choices at creator using POST API.
Hello,
Please explain your task. POST in server API commonly uses to post/store data on the server.
What does it mean "add choices at Creator", I don't understand either.
Thank you,
Andrew
SurveyJS Team