how can i bind datalist with ajax webservice
how can i bind datalist with ajax webservice
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manas MohapatraPosted Oct 2, 2017, 2:44 AM
Manas MohapatraPosted Oct 2, 2017, 5:07 AM
Gaurav RajPosted Oct 2, 2017, 4:35 AM
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
GetRecords();
}
});
function GetRecords() {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "http://localhost:11722/WebServiceSocialNet.asmx/getHome",
data: '{s: "' + 15+ '"}',
dataType: "json",
success: function (data) {
alert('success');
//Iterate through returned data and append it to the grid view
var row = $("[id*=DataList1]").eq(0).clone(true);
for (var i = 0; i < data.d.length; i++) {
// $(".name", row).eq(j).html(customer.find("ContactName").text());
row= $("#DataList1 .name").html(data.d[i].BlogId).text();
row = $("#DataList1 .blogPic").html(data.d[i].BlogPic).text();
row = $("#DataList1 .Blog").html(data.d[i].Blog).text();
row = $("#DataList1 .Date1").html(data.d[i].date).text();
row = $("#DataList1 .Time1").html(data.d[i].time).text();
row = $("#DataList1 .Blogby").html(data.d[i].blogbyname).text();
row = $("#DataList1 .UserPic").html(data.d[i].userpic).text();
row = $("#DataList1 .LIKED").html(data.d[i].liked).text();
row = $("#DataList1 .TotalComment").html(data.d[i].totallike).text();
row = $("#DataList1 .TotalLike").html(data.d[i].totalcomment).text();
// $("[id*=DataList1]").append(row);
//alert(row);
}
$("[id*=DataList1]").append(row);
},
error: function (result) {
alert("Error reading the web method error");
}
});
}
<%# Eval("Blog_Id") %>
Blog Pic: <%# Eval("Blog_Pic") %>
Blog<%# Eval("Blog") %>
Date1: <%# Eval("Date1")%>
Time1: <%# Eval("Time1")%>
TotalComment: <%# Eval("TotalComment")%>
TotalLike: <%# Eval("TotalLike")%>
UserPic: <%# Eval("UserPic")%>
Blogby: <%# Eval("Blogby")%>
BlogbyUserID: <%# Eval("BlogbyUserID")%>
LIKED: <%# Eval("LIKED")%>