reload a div after submitting a form
Posted
by pradeep
on Stack Overflow
See other posts from Stack Overflow
or by pradeep
Published on 2010-05-28T04:55:11Z
Indexed on
2010/05/28
5:01 UTC
Read the original article
Hit count: 217
i have code like this. which is actually a form .which lets user updates his ratings . once he clicks on update or save . i do a ajax and save his ratings and give him the success message. but how can i refresh this div to show his new ratings and i need to block update / save for this user for next 2 mins .how do i do it ? i use jquery framework
$myresult .= '';
$myresult .= '<form name =\'form1\' id=\'form1\' method = \'POST\' action=\''.$_SERVER['php_self'] .'\'>';
/* actual rating table - start - actual rate/update */
$myresult .= '<table id=\'rounded-corner\'>';
/* thead - start */
$myresult .= '<thead>';
$myresult .= '<tr>';
$myresult .= '<th width=\'30%\' class=\'rounded-company\' scope=\'col\'><span style=\'font: normal 18px Arial, Helvetica, sans-serif; color:#FFF;\'>Ratings</span></th>';
$myresult .= '<th width=\'70%\' colspan=\'2\'class=\'rounded-q4\' scope=\'col\'></th>';
$myresult .= '</tr>';
$myresult .= '</thead>';
/* thead - end */
/* tbody - start */
$myresult .= '<tbody>';
unset($i);
/*start printing the table wth feature and ratings */
for ($i = 1 ; $i < $numProperties; $i++){
if($master_rating_properties['rating'.$i.'_name']){
$myresult .= '<tr>';
/*fetch ratings and comments - 1st make it to null */
$indfeature = 0;
$comment = '';
$indfeature = $user_ratings['rating'.$i];
if($indfeature == NULL){ $indfeature = 0; }
$comment = $user_ratings['rating'.$i.'_comment'];
$myresult .= '<td width=\'22%\'>';
$myresult .= $master_rating_properties['rating'.$i.'_name'].' ( '.$indfeature.' )';
$myresult .= '</td>';
$myresult .= '<td colspan=\'0\' width=\'38%\' >';
if(($userId != '0') && (is_array($user_ratings)))
{
$tocheck = $indfeature;
}
else
{
$tocheck = '0';
}
for($k = 0.5; $k <= 10.0; $k+=0.5){
$tocheck = roundOff($tocheck);
if(($tocheck) == $k)
{ $chk = "checked"; }
else
{ $chk = ""; }
$myresult .= '<input class=\'star {split:2}\' type=\'radio\' name=\'rating'.$i.'\' id=\'rating'.$i.''.$k.'\' value=\''. $k .'\' '.$chk.' title=\''. $k.' out of 10 \' '.$disabled.' \' />';
}
/* for k loop end */
$myresult .= '</td>';
$myresult .= '<td width=\'40%\'>';
$myresult .= '<input title=\'Reason for this Rating.. \'type=\'text\' size=\'25\' name=\'comment'.$i.'\' id=\'comment'.$i.'\' style=\'display:;\' maxlength=\'255\' value="'.$comment.'">';
$myresult .= '</td>';
$myresult .= '</tr>';
}
/* end if loop */
}
/* end i for loop */
$myresult .= '</tbody>';
/* end tbody */
/* footer round corner start */
$myresult .= '<tfoot>';
$myresult .= '<tr>';
$myresult .= '<td class=\'rounded-foot-left\'> </td>';
$myresult .= '<td class=\'rounded-foot-right\' colspan=\'4\' >';
if(($userId != '0') && (is_array($user_ratings)))
{
$myresult .= '<input type=\'button\' id=\'update_form\' value=\'Update\'>';
}
else
{
$myresult .= '<input type=\'button\' id=\'save_form\' value=\'Save\'>';
}
$myresult .= '</td>';
$myresult .= '</tr>';
$myresult .= '</tfoot>';
$myresult .= '</table>';
/*round corner table end */
$myresult .= '</form>';
/*end the form to take ratings */
$myresult .= '</div>';
/*end 2nd tab */
© Stack Overflow or respective owner