Passing Created Table Row and Data back from ajax call

Passing Created Table Row and Data back from ajax call

I am trying to figure out how to pass the html back from an ajax call
let me give a couple snippets

jquery call
  1. <script>
  2. function add_reminder_row(){
  3.     var rrr=confirm("Please Confirm Reminder Addition");
  4.     if (rrr==true)
  5.       {
  6.         var MyData='';
  7.          var db ="<?php echo $_SESSION['db']; ?>";
  8.          MyData=MyData+'db='+db;
  9.          var debug="0";
  10.          if(document.getElementById('debug')){
  11.              var debug = (document.getElementById('debug').checked==true ? "1" : "0"); }
  12.          $("#main_page_div").mask_div("Waiting...");
  13.             $.ajax( {
  14.                 url : 'ajax/add_reminder.php',
  15.                 type : 'post',
  16.                 data : MyData,
  17.                 success : function( resp ) {
  18.                 $("#main_page_div").unmask_div();
  19.                 var $response=$(resp);
  20.                 var reminder = $response.find('#reminder').html();
  21.                 $('#bill_tbody tr:last').after(reminder);   
  22.                 $('#debug_div').html($('#inner_debug_div', resp).html());
  23.                 }
  24.             });     
  25.       }   
  26. }
  27.     </script>
the php response, i dont seem to be passing back for example the <tr></tr>
what am I doing wrong?

  1. $query="SELECT * FROM sc_bill_reminder WHERE id='$id' ";
  2. $debug_message.=$query."<br/>";
  3. $rowcount=0;
  4. $table_data="";
  5. $result=mysql_query($query);
  6. $reminder_row=mysql_fetch_assoc($result);
  7. $table_data.="<tr align='center' id='budgetrow_".$rowcount."' ><td>"."<input type='button' id = 'delete_".$reminder_row['id'].":budgetrow_".$rowcount."'  title ='Delete budget item ".$reminder_row['note'].".' value='X' />"."</td>";
  8. $table_data.="<td>".$reminder_row['bank_account_to']."</td>";
  9. $table_data.="<td>".$reminder_row['start_date']."</td>";
  10. $table_data.="<td>".$reminder_row['due_day']."</td>";
  11. $table_data.="<td>".$reminder_row['reminder_days']."</td>";
  12. $table_data.="<td>".$reminder_row['amount']."</td>";
  13. $table_data.="<td>".$reminder_row['note']."</td>";
  14. $table_data.="<td>".$reminder_row['link']."</td>";
  15. $table_data.="<td>".$reminder_row['chk']."</td>";
  16. $table_data.="<td>".$reminder_row['timestamp']."</td>";
  17. $table_data.="<td>"."<input type='button' id = 'edit_".$reminder_row['id'].":budgetrow_".$rowcount."'  title ='Edit budget item ".$reminder_row['note'].".' value='EDIT' /></td></tr>";
  18. $debug_message.="END DEBUG MESSAGE<br />";
  19. ?>
  20. <div> <!-- This is empty div and please don't remove this -->
  21. <div id="reminder"><?php printf($table_data);?></div>
  22. </div>