2009-08-13 58 views
0

我使用prototype.js,PDO,PHP。我想用ajax刪除與刷新記錄刷新刪除記錄的點擊div標記

的index.php

 <?php if(!isset($studentVoList)||count($studentVoList)==0){?> 
     <tr><td colspan="3" align="center">No records found.</td></tr> 
     <?php } else { 
      foreach($studentVoList as $studentVo) { 
     ?> 
     <tr> 
     <td align="center"><?php echo $studentVo->id;?></td> 
     <!--td align="center"><?php echo "1";?></td--> 
     <td> 
     <Select NAME="CoId" > 
      <Option VALUE="Item1">1</option> 
      <Option VALUE="Item2">2</option> 
      <Option VALUE="Item3">3</option> 
     </Select> 


     </td> 
     <td align="center"><?php echo $studentVo->st_name;?></td> 
     <td align="center"><?php echo $studentVo->st_city;?></td> 
     <td align="center"><?php echo $studentVo->st_created;?></td> 
     <td align="center"><?php echo $studentVo->st_modified;?></td> 

     <td align="center"> 
     <a href="javascript: submitForm('<?php echo $studentVo->id?>','view')">Edit</a></td> 
     <td align="center"> 
     <!--a href="javascript: submitForm('<?php //echo $studentVo->id?>','delete')">Delete</a></td--> 
     <a href="javascript: deleteId('<?php echo $studentVo->id?>')">Delete</a></td> 

     </tr> 
     <?php 
     } 
     } 
     ?> 

腳本

 function deleteId(id){ 

    alert("Id:="+id); 
     var myAjax = new Ajax.Request('delete.php',{method:'post',parameters: 'action='+ id}); 

    } 

刪除完成,但我刷新後,我要刷新點擊代碼刪除按鈕

回答