asp.net ajax get 调用(和post不一样,直接返回json才行,否则报错;post不能返回json)

 <script type="text/javascript" >

        $(document).ready(function () {

            $('#Label1').click(function () {


                $.ajax({
                    type: 'GET',
                    url: 'djb.aspx?sfzh=' + '3720510',
                    dataType: 'json',
                    success: function (data) {
                         //不需要解析,直接调用
                        //var parsedJson = $.parseJSON(data); 
                        alert(data.msg);
                    },
                    error: function (jqXHR) {
                        alert("失败!");
                    }
                });

                return false;

            });

        });
        
    </script>

 
            this.Response.Write( "{"msg":"ok"}"  );
            this.Response.Flush();
            this.Response.End();
        


 
原文地址:https://www.cnblogs.com/qqhfeng/p/10686737.html