2010-05-28 6 views
0

이 코드가 있습니다. 실제로는 사용자가 등급을 업데이트 할 수있는 양식입니다. 일단 그가 업데이트 또는 저장을 클릭하면 나는 아약스를하고 그의 등급을 저장하고 그에게 성공 메시지를 전한다. 하지만 어떻게이 div를 새로 고침하여 새로운 등급을 표시 할 수 있으며 다음 2 분 동안이 사용자에 대한 업데이트/저장을 차단해야합니다. 어떻게해야합니까? jquery 프레임 워크를 사용합니다.양식을 제출 한 후 div를 다시로드하십시오.

$ 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 */ 

답변

1

사용 jquery post 그리고 당신은 JSON 데이터를 반환하고 구성 요소 데이터를 업데이트 할 jquery html method를 사용할 수 있습니다. 그것은 단지 그리고 아이디어

+0

당신은 전체 블록을 재건하고 그것을 말하려는 것을 의미합니까? – Hacker

+0

어쩌면, 그리고 생각에만 – eos87

+0

하지만 그건 데이터 의식의 중복을 만듭니다 :( – Hacker

관련 문제