Avatar of Bob Schneider
Bob Schneider
Flag for United States of America asked on

Incorporate ASP date into JQuery

This is not functioning.  What can I do to modify it?

$(function () {
	var austDay = new Date();
	austDay = new Date(<%=Year(dEventDate)%>, <%=Month(dEventDate)%> - 1, <%=Day(dEventDate)%>);
	$('#cntdwn_0').countdown({until: austDay});
	$('#year').text(austDay.getFullYear());
});

Open in new window


Here is the body stuff:
					<%If UBound(EvntCntDwnArr, 2) > 0 Then%>
						<div class="info_area" style="border:medium ridge <%=sPrimColor%>;margin-bottom:5px;">
							<h5 style="margin-top:2px;">The Clock is Ticking...</h5>
	
							
							<%For i = 0 to UBound(EvntCntDwnArr, 2) - 1%>
								<%dEventDate = EvntCntDwnArr(2, i)%>
								<div id="cntdwn_<%=i%>"></div>
								<div style="text-align:right;margin:0;padding:0 5px 0 0;border-bottom:1px solid <%=sPrimColor%>;">until <%=EvntCntDwnArr(1, i)%></div> 
								<div style="clear:both;">&nbsp;</div>
							<%Next%>
							<%If Session("role") = "Coach" Then%>
								<tr>
									<td>
										<a href="../evnt_cntdwn/add_edit.asp">add/edit events</a>
									</td>
								</tr>
							<%End If%>
						</div>
					<%End If%>

Open in new window


Any help would be much appreciated!
ASPjQuery

Avatar of undefined
Last Comment
Bob Schneider

8/22/2022 - Mon
Scott Fell

what is not functioning?

<%If UBound(EvntCntDwnArr, 2) > 0 Then%>
is this true or false?

$('#cntdwn_0').countdown({until: austDay});
In your body stuff, do you have an element with id cntdwn_0 ?  <div id="cntdwn_0"></div>

$('#year').text(austDay.getFullYear());

In your body stuff, do you have an element with id year ?  <div id="year"></div>
Bob Schneider

ASKER
The first statement is true.  I do have a div id cntdwn_0.  I assume the div id=year is there as well.  This is a jquery utility that I got online.  It worked fine when I put a specific date into the function but when I try to incorporate an asp date it doesn't pass it,
Scott Fell

If you replace


      austDay = new Date(<%=Year(dEventDate)%>, <%=Month(dEventDate)%> - 1, <%=Day(dEventDate)%>);

 hard coded date it works?

Maybe it's the month.  Can you try changing <%=Month(dEventDate)%> - 1 to <%=cint(Month(dEventDate))-1%>
Your help has saved me hundreds of hours of internet surfing.
fblack61
Bob Schneider

ASKER
No I looked at the source code after the page posted and there is no date values in the jquery at all...
ASKER CERTIFIED SOLUTION
Scott Fell

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Bob Schneider

ASKER
I am defining the date now in the asp section of the page, prior to the html.  It is passing the correct date to the jquery now but it is getting me a wierd result when it displays.  The date is 7/23/2012 and it displays 0 hours 34 minutes 2 seconds no matter when I open the page.

Hmmmm.....
Bob Schneider

ASKER
Got it figured out.  Thanks a ton for your help!
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Bob Schneider

ASKER
Great assistance as I worked through the situation...