将数据追加到JQuery中的下拉列表框中 [英] Appending data to dropdownlist box in JQuery

查看:148
本文介绍了将数据追加到JQuery中的下拉列表框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

我正在通过Jquery调用Web方法来获取数据,并且需要将数据绑定到下拉列表框.

但我不能绑定相同.我使用的代码如下.

Dear Friends,

I am getting the data by calling the web method via Jquery and need to bind the data to dropdownlist box.

But I cant bind the same. The code I have used is below.

var dropdown = $("#ddl_req_by");

   var json = msg.d;
   $.each($.parseJSON(json), function () {
   alert(this.REQ_BY);
  $("#ddl_req_by").append($("<option></option>").val(this.REQ_BY).html(this.REQ_BY));
                                    
});


请一个人指导我.


Please can one guide me on this.

推荐答案

(" #ddl_req_by"); var json = msg.d;
("#ddl_req_by"); var json = msg.d;


.each(


.parseJSON(json ),功能(){ alert( .REQ_BY);
.parseJSON(json), function () { alert(this.REQ_BY);


这篇关于将数据追加到JQuery中的下拉列表框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆