不允许在.aspx文件里面写ajax。而是在html文件里面写ajax来读取数据库。
求详细的代码。本人菜鸟,望给点详细的解释

解决方案 »

  1.   

    可以使用jquery嘛,或者自己写呀,看一下ajax的简单例子就会了
      

  2.   

    只能说这个很简单,jquery任何一个教学课程都能找到相应的知识。
      

  3.   

    在aspx页面和html页面里通过ajax取数据还有什么不同之处吗?
      

  4.   

    $.ajax({
                    type: "POST",
                    url: "../../PrivateCmsService.svc/GetPagedNews",
                    data: '{"newsKindID":"0101","pageSize":"20","pageIndex":"1"}',
                    dataType: "json",
                    contentType: "text/json;",
                    beforeSend: function (XMLHttpRequest) {
                        $("#newslist").html(String.format(TIPS_TEXT, "<img src='../images/ajax-loader.gif' alt='' />", "请稍候……"));
                    },
                    error: function (XMLHttpRequest) {
                        $("#newslist").html(String.format(TIPS_ERROR, "ERROR", XMLHttpRequest.responseText));
                    },
                    success: function (result) {
                        var context = "";
                        $.each(result.d, function (i, item) {
                            context += item.Context;
                        });
                        $("#newslist").html(context);
                    }
                });