I am creating a website for my new project on my union, and I am having real problems with one seemingly small thing.
I am using php to create a forum table with a dynamic link with the following code:
<td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td>
<td bgcolor="#FFFFFF"><a id="viewTopic.php?id=<? echo $rows['id']; ?>" href="viewTopic.php?id=<? echo $rows['id']; ?>"><? echo $rows['topic']; ?></a><BR></td>
I want to use jquery to open a link from the table above in ajax div style. I did this successfully with other links using this code;
$("#forum").click(function(){
$("#subConList").html(loadAni).load('mainForum.php');
});
I have no clue how to do this due to php used in href table link. Spent hours trying to figure it out. Any assistance offers would be appreciated.
thank
I changed the tag to the button shown below
<button id="topic<? echo $rows['id']; ?>" href="viewTopic.php?id=<? echo $rows['id']; ?>"><? echo $rows['topic']; ?></button>
This is the jquery that I use to load content into the #subConList Div.
$(document).ready(function(){
$("#topic<?php echo $rows['id']; ?>").click(function(){
$("#subConList").html(loadAni).load('viewTopic.php?id=<?php echo $rows['id']; ?>');
});
});
source
share