views:

26

answers:

1

Hi

I am trying to set up a page that presents a grid with a sequence of times on it for a group of people. Essentially a calendar with rows for a specific time and columns for the person it relates to.

I intend to have a modal dialog box open when a user clicks on a time and load the current data via AJAX. This is very similar to the contact form example except of course that I will not know what the time and person are until the link is clicked. So I would like a way to pass this extra data to the dialog calling script.

Many thanks

A: 

A nice way of doing this is the new data-attributes in HTML5. Not to worry, they are supported by all browsers.

If your extra data is time and person, your link would look like this:

<a href="#" data-time="2011-01-01 11:11:11" data-person="John Smith">...</a>

And you can access this data in the javascript-function:

var link = this,
    time = link.getAttribute("data-time"),
    person = link.getAttribute("data-person");
Magnar