php - How to link a href with javascript -


i want have id being linked clicked result output want java script link avoid calling page. old way of coding this, have cut other info.

$id=$row["indexno"]; echo '     <tr>     <td>'. $row["indexno"] . '</td>     <td>'. $row["surname"] . '</td>     <td>'. $row["firstname"] .'</td>     <td><a href="update.php?indexno='. $id . '">view</a></td>     </tr>'; 

this way page update.php loaded url:.../update.php?indexno=1. want avoid page load introducing java script like

$(document).ready(function(){     $("#update").click(function(){         $("#content").load("update.php");     }); }); 

the thing don't seem know how link 2 on click of should put in href @ same time call id call distinct result selected indexno.

i think want :-

<td><a class= 'update' href="update.php?indexno='. $id . '">view</a></td> 

so when click on update link reqeust goes update.php?indexno={$id} , content load in #content element of page, , page not refresh

$(document).ready(function(){      $(document).on('click', '.update',function(){             $("#content").load($(this).attr('href'));             return false;  // __prevent default action                   }); }); 

thanks


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -