日期:2014-05-16  浏览次数:20638 次

jquery ajax为什么获取的data.d是object httprequest?
$.ajax({
                type: "Post",
                url: "demo.aspx/GetStr",
                //方法传参的写法一定要对,str为形参的名字,str2为第二个形参的名字     
                data: "nickname=" + $("#<%=nickname.ClientID %>").val(),
//                beforeSend: function (XMLHttpRequest) {
//                    $("#nickinfo").text("正在查询");
//                    //Pause(this,100000);
                //                },
                async: false,
                contentType: "application/json; charset=utf-8",
                dataType: "html",
                success: function (data) {
                    //返回的数据用data.d获取内容  
                    $("#nickinfo").text(data.d);
                    alert(data.d);
                },
                error: function (err) {
                    alert(err);
                }
            });    


public partial class demo : System.Web.UI.Page