Link to home
Start Free TrialLog in
Avatar of Bob Schneider
Bob SchneiderFlag 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!
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

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>
Avatar of 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,
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%>
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
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.....
Got it figured out.  Thanks a ton for your help!
Great assistance as I worked through the situation...