views:

110

answers:

1

Hi All,

  I am displaying a overlay on click of a row in the table. The over lay is a div

in the same page. This is working perfectly fine. But now my requirement is like if i click on row 1 it should display the row 1 and if row 2 is clicked it should display the row 2 and so on. But the problem is i can know the row clicked from the jquery. On click i show a overlay div. In the i load a php view using the code igniter. Now i need to know in the php server side which row i had clicked for the overlay to come up.

A: 

Why don't you use identifiers on each of the table rows?

For example:

<table>
  <tr id="row1" onClick="myMethod(this.id);">
  <td></td><td></td><td></td>
  </tr>
</table>


<script>
         function myMethod(rowID){
              //OPEN LAYER 
              //send information via XHR (XmlHttpRequest) INCLUDE the rowID in the REQUEST
             //DISPLAY THE XHR Response in the LAYER
         }
</script>

If i am correct you need to know which row triggered the request so you can show the correct response. For that as i explained use an identifier like the ID attribute.

andreas