I have created a modal window.
The div that opens is located on the same page.
When a link is clicked I would like to send the id of the record to the modal window.
Here is what I have so far, but it is not passing the variable to the modal.
[code]
$('a[name=modalMed]').click(function(e)
{
//cancel the link behavior
e.preventDefault();
//get the A tag
var id=$(this).attr('href');
var med=$(this).data('medidnum');
//get the screen height and width
var maskHeight=$(document).height();
var maskWidth=$(window).width();
//set height and width to mask to fill up the whole screen
$('#mask').fadeIn(500);
$('#mask').fadeTo("slow",0.8);
//get the window height and width
var winH=$(window).height();
var winW=$(window).width();
//set the popup window to center
$(id).css('top', winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).height()/2);
//transition effect
$(id).fadeIn(1000);
$.post(
'currentPage.php',
{
med:med
},
function(response)
{
}
)
return false;
});
[/code]
Here is the link:
[code]
<?php
while($medList=mysql_fetch_array($getMedsList))
{
?>
<li><a name="modal" href="#addMedicationsWindow" data-medidnum="<?php echo $medList['medID']; >"><?php echo $medList['medNameID']; ?></a></li>
<?php
}
?>
[/code]
Then here is the div that is setup to be the modal window:
[code]
<div id="addMeds">
<div id="addMedicationsWindow" class="window">
<center><h3>Add Medication</h3></center>
<?php
echo $medicine;
//get Name of Medication
$getMedName=mysql_query("SELECT * FROM medList WHERE medID=$medicine");
$medicineName=mysql_fetch_array($getMedName);
?>
<form id="addMedication">
<input type="hidden" value="<?php echo $medicine; ?>"><input type="text" value="<?php echo $medicineName['medNameID']; ?>" size="100">
<input type="submit" value="addMedication">
</form>
</div>
</div>
[/code]
Any insight would be appreciated.
Thanks,
ShoeGirl31