I have an application built using ASP.NET WebForms and JQuery. In my .aspx page I have a link that, when clicked, issues a JQuery AJAX request to a WebMethod in the page's codebehind that in turns reads data from the database and returns it as JSON objects.
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: 'Query.aspx/GetValues',
dataType: "json",
success: function (result) {
for (var i = 0; i < result.d.length; i++) {
var element = result.d[i];
}
}
});
All ok until now! The problems arises when I want to write out this JSON objects to the page, because for each of them I would like to generate HTML like that:
<li><a id="..." href="javascript:doPostback(...)">...</a></li>
In fact, I need to generate a sort of LinkButton client-side, because I need to make some server-side actions on PostBack. I don't know how to express this using JQuery.
I hope my question is clear.
Thank you very much!