Can someone please help me for providing value from asp in to javascript function?

I want to use "$('#countdown').countdown({until:$.countdown.UTCDate(+12, 2011, 9 -1, 5), format: 'DHMS', layout: " and where you can see the numbers, i want use value which i have retrieved from database.

Dani AI

Generated

As described, the classic ASP value must be emitted into the HTML the browser receives — server code runs before any client JavaScript. is correct that you must render the DB value into the page, but a safer, clearer pattern is to render the value as HTML data (or an ISO timestamp) and let plain client-side code build the Date/UTC value and call the countdown. This separates concerns and avoids putting raw server-side logic inside your script block.

A practical client-side snippet that reads server-filled data attributes and builds a UTC date (note the month conversion) is shown below. Have your ASP output the attributes on the countdown element (for example, data-year/data-month/data-day or a single data-target ISO string), then use code like this:

<script>
(function(){
  var el = document.getElementById('countdown');
  var y = parseInt(el.dataset.year, 10);
  var m = parseInt(el.dataset.month, 10) - 1; // convert 1-based month to 0-based
  var d = parseInt(el.dataset.day, 10);
  var h = parseInt(el.dataset.hour || 0, 10);
  var target = new Date(Date.UTC(y, m, d, h, 0, 0));
  $('#countdown').countdown({ until: target });
})();
</script>

Troubleshooting notes: check the generated HTML with "View source" to confirm the server actually wrote the values; ensure numeric values are output (not wrapped in extra quotes/commas); remember JavaScript months are zero-based (see MDN); and escape/encode the server output to avoid injection/XSS issues (OWASP XSS Prevention Cheat Sheet covers safe encoding patterns). If the plugin provides a UTC helper, you can use that, but converting on the client as above is generally simpler and less error-prone.

You simply need the following steps:

1. Connect to you database
2. Open connection
3. Launch your query for the value you want
4. In the javascript part of your page, response.write the data

For example, if the data variable is Timelog

<%
response.write(Timelog)
%>
or
<%=Timelog%>

5.Finally close your connection

You simply need the following steps:

1. Connect to you database
2. Open connection
3. Launch your query for the value you want
4. In the javascript part of your page, response.write the data

For example, if the data variable is Timelog

<%
response.write(Timelog)
%>
or
<%=Timelog%>

5.Finally close your connection

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.