I’m trying to to make a form that will submit a new record and automatically show that as DIV inside of the main DIV and after all the results from the PHP while loop.
Here is the while loop that I’ve built:
<?php
while ($row_apps = mysql_fetch_array($result_apps))
{
if ( ($row_apps['type'] == 'ar') && ($row_apps['client'] == NULL) ) {
echo '<center>
<div id="_'.$row_apps['app_id'].'" class="tab_listing">
<table width="248" border="0" cellspacing="10px" cellpadding="0px">
<tr>
<td width="100%" colspan="3"><div class="tab_listing_header">'.$row_apps['app_name'].'</div></td>
</tr>
<tr>
<td class="tab_listing_values"><b>App ID: </b>'.$row_apps['app_id'].'</td>
<td class="tab_listing_values"><b>Users: </b>'.$row_apps['users'].'</td>
</tr>
</table>
<div id="edit">Edit</div>
<a href="#" onclick="return show_confirm('.$row_apps['app_id'].')"><div id="delete"></div></a>
</div>
</center><br>';
}
}
?>
Now basically what i need to do is when a form is submitted and the new record is in the database i want it to show a new “block” exact same like the while “blocks” live.
I was thinking about something like:
$.post("create.php",{ value1:$('#value1').val(),value2:$('value2').val(),rand:Math.random() } ,function(data)
{
if(data=='yes')
{
HERE I'M STUCK.
Thanks!
Try this