Jquery Web服务我需要将json值绑定到div
$.ajax({
type: "POST",
url: "Newdashboard.aspx/finalvalue",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(),
datatype: 'json',
async: false,
success: function (data) {
if (data.d == '[]') {
alert('No Matches found');
}
else {
// here bind div
}
},
error: function (e) {
alert("check once...");
}
});
finalvalue
方法提供的表仅包含值(如50/90/33)
我需要绑定到具有该结果的div,我该怎么做呢。
答案 0 :(得分:1)
success: function (data) {
if (data.d == '[]') {
alert('No Matches found');
}
else {
// here you amend the data from service.
$("div#divId").html(data.d);
}
}
jQuery HTML用于解决方案,请检查。
答案 1 :(得分:0)
您可以使用jQuery函数.append()。这会将结果添加到div的末尾。