I am using $.post()
to call an ASP script, which among other things has the following code:
%>
<script type="text/javascript">
strTributeID = <% NTC %>
$('body').data(tributeID, strTributeID);
alert ($('body').data(tributeID));
</script>
<%
Before the page is refreshed (so DOM data should not have been wiped out), I call another $.post() which does this upon success:
var strTributeID = $('body').data(tributeID);
However, the value does not appear to be retained, or perhaps not set correctly. What might be wrong?
You are not writing the NTC
value to the page, only evaluating it and throwing it away. Use the <%=
tag:
strTributeID = <%= NTC %>;