On Tue, Jan 19, 2010 at 1:45 PM, parot <russ...@parotkefalonia.com> wrote: > I want to scroll back and forward through the months on a calendar without > refreshing the page. I have the php calendar, but I don't want any page > refresh which I can do with PHP and just send the GET to the page. so > ideally what I need is 2 links back and forward with the month variable i.e. > 1-12 (Jan - Dec) passed to JQury/Ajax. I have been looking at a number of > scripts, but all to far complex (i.e. do more than I need) just I cant > fathom out how to pass Back (Jan go to Dec) or Forward (Jan go to Feb) and > so on. just need 1 month at a time, nothing fancy etc.
How's about something like this? <button id="prevMonth">Previous month</button> <div id="calendar"></div> <button id="nextMonth">Next month</button> <script type="text/javascript"> var currentMonth = 1; function loadMonth(newMonth) { $("#calendar").load("getCalendar.php?m="+newMonth); } $().ready(function() { loadMonth(currentMonth); $("button#prevMonth").click(function() { loadMonth(--currentMonth); }); $("button#nextMonth").click(function() { loadMonth(++currentMonth); }); }); </script>