如何通过Javascript或JQuery绑定单选按钮列表 [英] How to Bind the radio button list via Javascript or JQuery

查看:114
本文介绍了如何通过Javascript或JQuery绑定单选按钮列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...任何人都可以帮助您通过Javascript或JQuery绑定单选按钮列表吗?
数据是从Json和Webservice返回的数组列表.

Hi...anyone can help on how to Bind the radio button list via Javascript or JQuery?
Data is array list return from Json and webservice.

$.ajax(
        {
         type: "POST",
         url: "../../Webservice/Control.asmx/getIdea",
         data: "{'D':'" + HP + "'}",
         contentType: "application/json",
         dataType: "json",
         success: function (data) {
         for (var i = 0; i < data.d.length; i++) {
           AddListItems(rblIdea, data.d[i].MGrpT, data.d[i].MGrpV);    
        }
         },
               failure: function (response) {
                   alert(response.d);
               }
           });

推荐答案

.ajax( { 类型:" , 网址:" , 数据:" + HP + " , contentType:" , dataType:" , 成功:功能(数据){ for ( var i = 0 ; i < data.d.length; i ++){ AddListItems(rblIdea,data.d [i] .MGrpT,data.d [i] .MGrpV); } }, 失败:功能(响应){ 警报(response.d); } });
.ajax( { type: "POST", url: "../../Webservice/Control.asmx/getIdea", data: "{'D':'" + HP + "'}", contentType: "application/json", dataType: "json", success: function (data) { for (var i = 0; i < data.d.length; i++) { AddListItems(rblIdea, data.d[i].MGrpT, data.d[i].MGrpV); } }, failure: function (response) { alert(response.d); } });


ASP.NET 4.0能够执行客户端数据绑定ASP.NET AJAX 4.0中的数据绑定 [
ASP.NET 4.0 has the ability to do client-side data binding Data Binding in ASP.NET AJAX 4.0[^]

If you are not using 4.0, then it is simply a matter of iterating through your array and appending html elements to the container


(" ).append(" +一些值+ </option>");
("#mySelect").append("<option>" + some value + "</option>");



http://jquery.com/ [ ^ ]



http://jquery.com/[^]


这篇关于如何通过Javascript或JQuery绑定单选按钮列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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