# Dynamic dropdown menu from ajax request

**URL:** <https://discourse.nodered.org/t/dynamic-dropdown-menu-from-ajax-request/44126>\
**Category:** General\
**Created:** [13 April 2021 19:47 UTC](https://discourse.nodered.org/t/dynamic-dropdown-menu-from-ajax-request/44126 "2021-04-13T19:47:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarthak7034](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sarthak7034/32/40258_2.png) [@sarthak7034](https://discourse.nodered.org/u/sarthak7034)\
**Post date:** [13 April 2021 19:47 UTC](https://discourse.nodered.org/t/dynamic-dropdown-menu-from-ajax-request/44126/1 "2021-04-13T19:47:59Z")

</div>

So, I am trying to create a dynamic dropdown box from the ajax request received inside oneditprepare.  
I am trying to get an id and all its operations into the dropdown box dynamically.  
Example:-

```auto
                $.ajax({
                    url:url_base + '/list-services',
                    success: function (params) {
                        let json =params.data
                        console.log(json)
                    }
                })

```

The data I am getting back is in JSON format.

Example of how I am creating dynamic dropdown box  
const newOp = (`<option>${gg}</option>`)  
$("#node-input-operation").append(newOp)

---

<div class="post-metadata">

**Author:** ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)\
**Post date:** [13 April 2021 21:40 UTC](https://discourse.nodered.org/t/dynamic-dropdown-menu-from-ajax-request/44126/2 "2021-04-13T21:40:50Z")

</div>

Hello,  
I do this in some of my nodes. Here is an example, first the html part:

> <https://github.com/johanneskropf/node-red-contrib-sox-utils/blob/dfbd82001115cc23b3adb3128519ff64790bdf15/sox_record.html#L81>

and here is the corresponding part in the js file:

> <https://github.com/johanneskropf/node-red-contrib-sox-utils/blob/dfbd82001115cc23b3adb3128519ff64790bdf15/sox_record.js#L441>

hope this helps, Johannes

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 June 2021 21:41 UTC](https://discourse.nodered.org/t/dynamic-dropdown-menu-from-ajax-request/44126/3 "2021-06-12T21:41:48Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
