why do i lose my hidden field value?
- by user517406
Hi,
I have some hidden fields on my page, all of which work fine apart from one. I am setting the value in document.ready, before calling buildGrid() :
$(document).ready(function() {
$.ajax(
{
type: "POST",
url: "/CDServices.asmx/GetWeekEndingDates",
data: "{}",
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function(msg) {
//store default dates in hidden fields
$("#<%=hdnCurrentDate.ClientID%>").val(msg.d.CurrentDate);
$("#<%=hdnLastWeekEndingDate.ClientID%>").val(msg.d.LastWeekEndingDate);
}
});
buildGrid();
});
Yet in buildGrid, the value in the hidden field is empty :
function buildGrid() {
alert($("#<%=hdnLastWeekEndingDate.ClientID%>").val());
I call other functions on button clicks where the hidden field value is picked up fine, why does the value disappear here?