jquery 怎么没加载数据?console.log(err)没报错,但数据没加载过来,这是什么回事
经过断点调试的时候发现可以加载数据,取消断点后就加载不了,这是怎么回事?
<script type="text/javascript">
$(document).ready(function (e) {
$(".more").click(function () {
$(".link_list_show").hide();
$(".spread_list_show").show();
var linkid = $(this).attr("myvalue");
var params = '{linkid:"' + linkid + '"}';
$.ajax({
type: "post",
url: "HomeData.aspx/LoadData",
data: params,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
var lbl = document.getElementById("class_link");
lbl.innerHTML = data.d["billCount"];
var lbl2 = document.getElementById("link_list");
lbl2.innerHTML = data.d["billCount1"];
},
error: function (err) {
console.log(err);
}
});
});
$(".return").click(function () {
$(".link_list_show").show();
$(".spread_list_show").hide();
})
});
</script>
[WebMethod]
public static Hashtable LoadData(string linkid)
{
DataTable dt = links.getlinkall(Convert.ToInt32(linkid));
string html = "";
foreach (DataRow dr in dt.Rows)
{
html += "<li><a href='" + dr["url"] + "' target='_blank'>" + dr["ItemName"].ToString() + "</a></li>";
}
string linkname = links.getlinkinfo(Convert.ToInt32(linkid)).Rows[0]["GroupName"].ToString();
var data = new Hashtable
{
{"billCount",linkname },
{"billCount1",html},
};
//获取数据
return data;
}