我这每一句的注释都写的对吗?

<script type="text/javascript">
            $(document).ready(function(){
                $('#btn').on('click',function(){
                    var $this = $(this)
//                  获取到按钮元素赋值给变量

                    $.getJSON('new_file.json',function(data){
//                  用.getJSON()方法获取到 JSON 内的数组,用data进行操作    
                        
                        $this.attr("disabled","true")
//                  禁用元素    使其失去作用
                    $.each(data, function(index,sport) {
//                      遍历 data 数组 (index代表数组下标 sport代表数组值)
                        if(index == 2 ){
                            $('p').append(sport["name"])
//                          找到下标 2  在选中的元素内加上 sport.name
                        }
                    });    
                    })
                })
            })
        </script>


Anoxia_
浏览 1244回答 1
1回答

Jerps

<script type="text/javascript">             $(document).ready(function(){                 $('#btn').on('click',function(){                     var $this = $(this) //                  保存this对象,留备后用,你那解释也行                       $.getJSON('new_file.json',function(data){ //                  用.getJSON()方法获取到 JSON 内的数据,将数据(data)传入function操作                                                    $this.attr("disabled","true") //                  禁用元素    使其失去作用                     $.each(data, function(index,sport) { //                      遍历 data 数组 (index代表数组下标 sport代表数组值)                         if(index == 2 ){                             $('p').append(sport["name"]) //                          找到下标2,在p下添加(绑定)子元素(当前sport数据中键值对,键为name);                         }                     });                         })                 })             })         </script>

慕瓜9220888

CNZYLFPCQIGMYXSWJJWHTXSGJGGTBGWRLFLPVGYTTTWQKRSEZICVMTFWOUTQXUKJKGBHKXLYDVUTYFMKVPGZUANIWJUFBZYSSFPZQVBQANUVXPUQLIIWJCZEJXADZGIZLETCWCLTAFXSOBRUVTLJLHHUIUOCDUUAWFYFAIXXWOUWAZSNQQPTGFAWVIZRIKIGYNTSIIZGNIQQWFPGUJRJSIVWWHHMKXZCICQYDMFRBEYGVJOEUQXYMUSKUQCITRCKZIBKASDRAORDMPCQEDRRQAJLVAIAQZPIZGOWBRXQUTNYWBRKTLRBDSXWZPCDQVHWVIZZZUMUMLVBFCGINFEWZFPQVTIYJJICWVWKJWFVUDRQVRENTIZNAAKDJZCTCQPQZIFEBQOFORAXRFNFKCBILEVFEJIYUAUCAPOKGDZOPKCX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