Passing variables through modal
Hey Guys,
I've run into a problem where it involves passing a variable to a jquery modal dialogue upon a user clicking a link.
*This also is a topic where it involves some php.
Basically, at the moment i have got 2 results from a database that each have a id (24, 25). The links are displayed on schedule.php. When the user clicks one of these links, it will open up the modal (lineup.php), which will then show the id depending on what link the user has clicked.
I have given it my best shot, but my javascript is not the best.
schedule.php
- <div id='basic-modal'><a href="schedule.php?id=24" class='basic'>Link One </a></div>
- <div id='basic-modal'><a href="schedule.php?id=25" class='basic'>Link Two </a></div>
lineup.php
- <?
- $id = $_GET['id'];
- echo $id;
- ?>
Javascript
- jQuery(function ($) {
- // Load dialog on click
- $('#basic-modal .basic').click(function (e) {
- $.get("schedule.php?id=" + this.hash.substr(1), function (data ){
- $('#content-one').modal({
- overlayClose:true,
- opacity:40
- });
-
- });
- return false;
- });
- });
At the moment, when i click on a link it opens the modal, and says this:Notice: Undefined index: id in /Users/Tim/Sites/2012MP/modals/lineup.php on line 18Any help much appreciated. Cheers Guys.