Hi,
I am trying to add some values retrieved from database, into a HTML table which I've already created using jQuery & AJAX.
My data is getting retrieved properly, but its not getting displayed when I am loading the HTML page. Could anybody help ASAP??
Here's the code I'm using to achieve this:
<script src="../Scripts/jquery-1.7.min.js"></script>
<script type="text/javascript">
function getMemberDetails(userID) {
$.ajax({
url: "../Handlers/GetMemberDetails.ashx",
data: { uID: userID },
dataType: "json",
async: false,
success: getMemberDetSucc,
error: function (xhr, ajaxOptions, thrownError) {
}
});
}
function getMemberDetSucc(resultSet) {
$(resultSet).each(function (i, MemberData) {
alert(MemberData.strFName + " " + MemberData.strLName);
$('#memName').append('<td style="text-align:left"><label id="lbl_MemName">'+MemberData.strFName+" "+MemberData.strLName+'</label></td>');
})
}
$(document).ready(function () {
document.getElementById('showPopup').onclick = getDetails;
function getDetails() {
getMemberDetails("1");
}
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:LinkButton PostBackUrl="#openModal" runat="server" ID="showPopup">Open Modal</asp:LinkButton>
<div id="openModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<h2>MEMBER DETAILS</h2>
<div class="container" style="width:400px; height:150px">
<table style="width:250px; float:right" class="table">
<tr id="memName">
<td style="text-align:right"><asp:Label ID="Label1" Font-Bold="true" runat="server" Text="Name: "></asp:Label></td>
<!--The appended label should come here, but its not coming-->
</tr>
</table>
</div>
<hr />
</div>
</div>
</form>
</body>
</html>
When I click the link having ID:openModal it displays the Popup Window, where I should have the appended table cell which is not appearing!! Please help!