Forum Moderators: open

Message Too Old, No Replies

Display weekly calendar

         

bond

2:15 pm on Mar 3, 2010 (gmt 0)

10+ Year Member



Hi guys,
I'm new here and i need a little help and guidance.
I need to do a weekly calendar where i will display the available hours for booking like this one <snipped screenshot>
My question is what's the best way to do it?
Can you point me in the right direction?
thanks.

[edited by: whoisgregg at 6:13 pm (utc) on Mar 4, 2010]
[edit reason] Whoops, no URLs please. See TOS [webmasterworld.com] :) [/edit]

whoisgregg

6:16 pm on Mar 4, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, bond!

Any kind of booking/availability system is going to need to have a database backend to be of any use. Do you have that coded up yet?

As far as javascript goes, you could use it to make the interface to the booking system more user-friendly (by using AJAX to fetch the data instead of reloading the page each time they click anything) but it won't be able to actually handle what's been booked and what hasn't.

bond

6:48 pm on Mar 4, 2010 (gmt 0)

10+ Year Member



Hi, yes i have the db done.
I have retrieve the values from the db and display them on my page. The problem is that i need to maintain those results refreshed so that we shouldn't refresh the page to see if an hour is available or not. I know that this must be done in ajax and i just need a little help in how i can do it.
I'm new to ajax so i'm completely lost with this.
I couldn't find any tutorial that i could use as base if you guys have any, please share it.
Thanks

whoisgregg

6:43 pm on Mar 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Probably the easiest way to do this would be to use one of the many existing javascript libraries that have built-in AJAX support. If you use Prototype [prototypejs.org] for example, having a block of html update automatically is as simple as this:

new Ajax.PeriodicalUpdater('calendar', '/script.php?year=2010&month=3',
{
method: 'get',
frequency: 1,
decay: 2
});

That code replaces the contents of an object with the id of "calendar" with whatever html that /script.php outputs.

Other libraries that make this easy include YUI Library [developer.yahoo.com] and jQuery [jquery.com]