I have a page where ID is generated dynamically and be fetch from database and I put the result inside <a> tag :
<?php while($row = mysql_fetch_array($result))
{ ?>
<a href="<?php echo $row['id']; ?>" onclick="myfunc(); return false;">ID Number 1</a><br />
<a href="<?php echo $row['id']; ?>" onclick="myfunc(); return false;">ID Number 2</a>
<?php } ?>
and when user click the link, the javascript myfunc() function will be trigger.
function myFunc(){
$("#div").load("get_id.php?","id="+"SHOW THE $row['id'] HERE"); }
But I don’t know how to retrieve href value and put it inside the load() method. Can someone show me the correct way?
Thank you
-mike
Make sure that you generate a complete href attribute:
and then attach a click handler unobtrusively (don’t mix markup and javascript):