Send PHP variable to AJAX
Hi guys,
I send variable to AJAX for editing some data in table, but every time when I clicked in any rows JS receive my first clicks variable
- <table id="link-table" cellpadding="0" cellspacing="0" border="0" class="display dt2">
- <thead>
- <tr>
- <th>a</th>
- <th>b</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $stmt = "SELECT a, b FROM ast.cdr ORDER BY a desc";
- $result = mysql_query( $stmt, $conn );
- while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
- $id= $row['src'];
-
- ?>
- <tr class="gradeX">
-
-
- <td><span name="<?php echo $row['a'];?>"><?php echo $row['a'];?><span></span></td>
- <td><?php echo $row['billsec']?>.сек</td>
- <td>
- <a href="#" class="sepV_a fd2" title="Edit"><img src="img/ico/pencil_gray.png" alt="" /></a>
- <a href="#" class="sepV_a chist" title="View"><img src="img/ico/preview_gray.png" alt="" /></a>
- <a href="#" class="sepV_a delete_button" title="Del"><img src="img/ico/trashcan_gray.png" alt="" /></a>
- </td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
and my JS code
- $(".fd2").fancybox({
- href : 'search_result.php',
- ajax : {
- type : "POST",
- cache : false,
- data:{search_item : name},
- success: function(result)
- {
- console.log(result);
- }
- },
- });