Reload the table with JQuery

aobokzoy

New Member
I have the following issue. Here is my index.php :\[code\]<div id="tabs"> <ul> <li><a href="http://stackoverflow.com/questions/3778409/#tabs-1">A projects</a></li> <li><a href="http://stackoverflow.com/questions/3778409/#tabs-2">B projects</a></li> </ul> <div id="tabs-1"> <?php echo loadTabs(1);?> </div> <div id="tabs-2"> <?php echo loadTabs(2);?> </div>\[/code\]Here are my two php functions that build the tables:\[code\]function loadTabs($settingId){$query = 'select * from deployments_settings where id="'.$settingId.'"';$result = mysql_query($query);$html = '<div id="tab'.$settingId.'_container">'; while ($row = mysql_fetch_array($result)) { $html .= '<div id="tab'.$settingId.'_buttons">'; $html .= '<button id="add_project">'.$row['addbuttoncaption'].'</button>'; $html .= '</div>';// id="tab[1..2]_button_add" $html .= '<div id="tab'.$settingId.'_content">'; $html .= '<br/>'; $html .= loadTables($settingId, $row['deploymentstable']); $html .= '</div>';//id=tab[1..2]_[first..second]content }//while $html .= '</div>';// id="tab[1..2]_container"return $html;}function loadTables( $tableId, $tableName ) {$query = 'select * from '.$tableName.' order by `id` desc';$result = mysql_query($query);$html = '<table id="tab'.$tableId.'_table" class="tabTable">';$html .= '<thead><tr>';$html .= '<th>#</th>';$html .= '<th>Project number</th>';$html .= '<th>Deadline</th>';$html .= '<th>Assign to</th>';$html .= '<th>Description</th>';$html .= '<th>Action</th>';$html .= '</tr></thead>';$html .= '<tbody>'; $countRow = 0; while ($row = mysql_fetch_array($result)) { $html .='<tr>'; $html .= '<td class="colID">'.++$countRow.'</td><td class="colPN">'.$row['name'].'</td><td class="colDL">'.$row['deadline'].'</td><td class="colAT">'.$row['assignto'].'</td><td>'.$row['description'].'</td>'; $html .= '<td class="colACT">'; $html .= '<button id="edit_action">Edit</button>'; $html .= '<button title="Remove" contentReload="'.$tableId.'" rrTable="'.$tableName.'" rrID="'.$row['id'].'" id="delete_action">Delete</button>'; $html .= '</td>'; $html .= '</tr>'; }//while$html .= '</tbody>';$html .= '</table>';return $html;}\[/code\]Here is my JQuery part For button delete. \[code\]$( "button#delete_action") .button({icons: {primary: "ui-icon-circle-minus"}, text: false}) .click(function() { var contentReload = $(this).attr("contentReload"); //alert(contentReload); if(confirm("Press OK to confirm DELETE operation")) { $.post("coreDB.php", { action: 3, rrTable: $(this).attr("rrTable"), rrID: $(this).attr("rrID"), contentReload: $(this).attr("contentReload") }, function(data, textStatus, XMLHttpRequest) { //alert(data); $("#tab"+ contentReload + "_table").html(data); }); //post } //if then condition });\[/code\]The issue is this -> when "delete button" run successfully it gives back the table output that I re-apply to the table object\[code\]$("#tab"+ contentReload + "_table").html(data);\[/code\]. But unfortunately it doesn't reload the the table and all goodies from JQuery don't work too. Is anything I need to work on JQuery side in order to reload the table. Thank you in advance!
 
Back
Top