为什么没有效果?

来源:1-1 使用load()方法异步请求数据

慕粉3804975

2016-12-30 11:26

 <script type="text/javascript">

            $(function () {

                $("#btnShow").bind("click", function () {

                    var $this = $(this);

                    $("ul")

                    .html("<img src='Images/Loading.gif' alt=''/>")

                    .load(" http://www.imooc.com/data/fruit_part.html",function (data) {

                    $this.attr("disabled", "true");

               

                        });

                        

                    });

                })

            });

        </script>


写回答 关注

2回答

  • Bobo0915
    2016-12-30 18:52:22
    已采纳

    <script type="text/javascript">

                $(function(){

                    $("#btnShow").click(function(){

                      var tis=    $(this);

                      $("ul").html("<img src='Images/Loading.gif' alt=''/>").load("http://www.imooc.com/data/fruit_part.html",function(){

                          tis.attr("disabled","true");

                      });

                    });

                });

            </script>

    慕粉3804...

    非常感谢!

    2017-01-05 10:20:03

    共 1 条回复 >

  • 哈士奇二二
    2017-01-05 10:18:13

    已将你的代码复制测试,发现是因为你的代码中多写了一个 "  })  ",删除其中一个即可.

jQuery基础(五)一Ajax应用与常用插件

如何用jquery实现ajax应用,加入学习,有效提高前端开发速度

69094 学习 · 400 问题

查看课程

相似问题