ajax遍历数据生成下拉框

<script type="text/javascript">
    
    function GetEQIDList(ModuleID)
    {
        $.ajax({
            type:"POST",
            contentType:"application/json",
            url:"/FDCService/FDCService1.asmx/GetToolIDs",
            data:"{moduleID:'"+ModuleID+"'}",//傳参
            datatype:'json',
            success:function(result){
            try{
                $('#toolList').empty();
                     $(result.d).each(function() {
                            $("#toolList").append("<option selected='selected' value='" + this + "'>" + this + "</option>");
                        });
                }catch(e){
                    alert(e); 
                }
              },
             error: function(result, status){
                if(status=='error'){
                    alert(result);
                }
             }
        });  
    }
    </script>    

posted @ 2017-07-21 16:45  懒得像猪  阅读(812)  评论(0编辑  收藏  举报