I am altering a form and placing a new 'button' . On the press of the button, using the #ajax property , I want to display 2 separate tables with checkboxes for each row. Each table has separate data.

The 2 tables should be initially hidden and should become visible on button press. How should I proceed with this ??

The table data is fetched from database and some operations are performed on it.. so where should I put this code ? In the callback function ?

Update- I tried to implement this by using tableselect, but the checked boxes aren't returning the values in the $form_state['values']. You can check out the code [here][1] 
 or suggest me a simpler interface to implement. 


  [1]: https://drupal.stackexchange.com/questions/39726/form-statevalues-for-table-select-returning-empty-arrays#comment40370_39726