简体   繁体   English

提交表格后重新加载div

[英]reload a div after submitting a form

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. 我做一个ajax并保存他的评分并给他成功的信息。 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 ? 但是我如何刷新此div以显示他的新评分,并且我需要在接下来的2分钟内阻止该用户的更新/保存。我该怎么做? i use jquery framework 我使用jQuery框架

$myresult .= ''; $ 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\'>&nbsp;</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 */

use jquery post and you can return a JSON data and use the jquery html method to update the component data. 使用jquery post ,您可以返回JSON数据,并使用jquery html方法更新组件数据。 it just and idea 它只是和想法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM