Load Data from Web Services
SurveyJS Form Library allows you to populate drop-down menus with data loaded from a REST API web service. For this purpose, drop-down form fields include the choicesByUrl property. It accepts an object with the following properties:
url: string
A RESTful service's URL. It may include placeholders that allow you to use question values as URL query parameters (see thereg_countryquestion in this demo).valueName: string
Specifies which field contains choice values.titleName: string
Specifies which field contains display texts for choice values.path: string
A path to the array of choices. Specifypathonly if the array of choices is nested within the object returned by the service. The following path separators are allowed: semicolon (;), comma (,).
When you use choicesByUrl, the form field queries an entire dataset in a single request. This technique may decrease performance on large datasets. In this case, we recommend that you implement lazy loading.