How to populate dropdownlist with JSON data as ajax response in jQuery

后端 未结 7 1232
梦谈多话
梦谈多话 2021-02-05 14:47

I am working on a j2ee application. In my application I have a drop-down list(or Select element). I want to populate this drop-down list with JSON data as a Ajax response.

相关标签:
7条回答
  • The simplest way is to download this library https://github.com/JocaPC/jquery-view-engine/tree/master/src . This JQuery library directly loads JSON into dropdows and looks like a perfect match for your example. You just need to put the following code:

    success: function (data) {
                $('#ch_user1').view(data.aaData); 
    }
    

    Take a look at this page https://jocapc.github.io/jquery-view-engine/docs/ajax-dropdown for more details.

    0 讨论(0)
提交回复
热议问题