2013-10-09 660 views
-5
主頁

這是我的AJAX頁面代碼,我需要張貼此值到我的主頁更新,我把查詢的主頁上查詢,所以我需要通過點擊發布我的價值觀提交彈出按鈕如何將AJAX頁面值傳遞給

<? include "../common/config.php";include "../common/functions.php";?> 
<div class="tkt_data" > 
    <form method="post"> 

    <table cellspacing="0" cellpadding="0" align="center" class="tkt_table"> 
    <tr> 
     <th style="border-right: none;background:url(../images/right_top_bg1.jpg) 0 0 repeat-x;height: 33px;" class="enterprise_info_txt" colspan="11"><? if($_REQUEST['id'] != "") {echo $department_name_fetch['DEPARTMENT_NAME']." >> "; }?>Manage User Access Rights 
     <span style="float: right;"><input type="search" value="" onchange="search()" id="searchfield" onKeydown="javascript:if(event.keyCode==13)" name="search"><div class="icon_search"><img align="right" src="../images/icon_search.png" onclick="search()"></div></span></th> 
    </tr> 
    <tr> 
     <th width="20%" align="left" onclick="cost('CIRCULAR_NO')" id="an" style="width: 95px;"> <span style="float:left">Ticket No</span><span id="circularno" class="column_sort_even"></span></th> 
     <th width="20%" align="left" onclick="cost('CIRCULAR_DATE')" id="ac" style="width: 95px;"><span style="float:left">View</span><span class="column_sort_even" id="circulardate" ></span></th> 
     <th width="30%" align="left" onclick="cost('CIRCULAR_DESC')" id="as" style="width: 95px;"><span style="float:left">Download</span><span id="circulardesc" class="column_sort_even"></span></th> 
     <th width="30%" align="left" onclick="cost('CIRCULAR_DESC')" id="as" style="width: 95px;"><span style="float:left">Comment</span><span id="circulardesc" class="column_sort_even"></span></th> 
     <th width="5%" align="left" onclick="cost('CIRCULAR_DESC')" id="as" style="width: 95px;"><span style="float:left">Department</span><span id="circulardesc" class="column_sort_even"></span></th> 
     <th width="5%" align="left" onclick="cost('CIRCULAR_DESC')" id="as" style="width: 95px;"><span style="float:left">Resource</span><span id="circulardesc" class="column_sort_even"></span></th> 
     <th width="5%" align="left" onclick="cost('CIRCULAR_DESC')" id="as" style="width: 95px;"><span style="float:left">Status</span><span id="circulardesc" class="column_sort_even"></span></th> 
     <th width="5%" align="left" onclick="cost('CIRCULAR_DESC')" id="as" style="width: 95px;"><span style="float:left">Priority</span><span id="circulardesc" class="column_sort_even"></span></th> 
     <th width="5%" align="left" onclick="cost('CIRCULAR_DESC')" id="as" style="width: 95px;"><span style="float:left">Delete</span><span id="circulardesc" class="column_sort_even"></span></th> 
     <th width="5%" align="left" onclick="cost('CIRCULAR_DESC')" id="as" style="width: 95px;"><span style="float:left">Re open</span><span id="circulardesc" class="column_sort_even"></span></th> 
     <th width="5%" align="left" onclick="cost('CIRCULAR_DESC')" id="as" style="width: 95px;"><span style="float:left">All</span><span id="circulardesc" class="column_sort_even"></span></th> 
    </tr> 
    <tr> 
     <td colspan="11"> 
     <div id="search_sort_replacement"> 
     <table width="100%" cellspacing="0" cellpadding="0" align="center"> 
     <tr> 
      <td> 
      <div class="tkt_admin_info" > 
      <table width="100%" cellspacing="0" cellpadding="0" align="center" class="tkt_table_data">        

       <? $i=0; if($i%2==0){?> 
       <tr class="even_row"> <?}else{?><tr class="odd_row"><? } ?>  
        <?php $user_id=$_GET["rightsid"]; $users_rights= mysql_fetch_assoc(mysql_query("select * from user_access_rights where USER_ID = " .$user_id)); 
      ?> 
        <td><input type="hidden" id="useridnum" value="<?= $user_id; ?>"/></td> 
       <td width="20%" class="enterprise_table_values" style="width: 95px;" align="center"><input type="checkbox" class="rights" /></td> 
       <td width="20%" class="enterprise_table_values" style="width: 95px;" align="center"><input id="r_view" type="checkbox" class="rights" <?php if($users_rights['TICKET_VIEW']==6){?>checked value="6"<?}else{?>value="5"<?}?> /></td>  
       <td width="20%" class="enterprise_table_values" style="width: 95px;" align="center"><input id="r_download" type="checkbox" class="rights" <?php if($users_rights['TICKET_DOWNLOAD']==6){?>checked<?}?> /></td> 
       <td width="20%" class="enterprise_table_values" style="width: 95px;" align="center"><input id="r_comment" type="checkbox" class="rights" <?php if($users_rights['TICKET_COMMENT']==6){?>checked<?}?> /></td> 
       <td width="20%" class="enterprise_table_values" style="width: 95px;" align="center"><input id="r_dept" type="checkbox" class="rights" <?php if($users_rights['TICKET_DEPARTMENT']==6){?>checked<?}?> /></td> 
       <td width="20%" class="enterprise_table_values" style="width: 95px;" align="center"><input id="r_resorce" type="checkbox" class="rights" <?php if($users_rights['TICKET_RESOURCE']==6){?>checked<?}?> /></td> 
       <td width="20%" class="enterprise_table_values" style="width: 95px;" align="center"><input id="r_status" type="checkbox" class="rights" <?php if($users_rights['TICKET_STATUS']==6){?>checked<?}?> /></td> 
       <td width="20%" class="enterprise_table_values" style="width: 95px;" align="center"><input id="r_priority" type="checkbox" class="rights" <?php if($users_rights['TICKET_PRIORITY']==6){?>checked<?}?> /></td> 
       <td width="20%" class="enterprise_table_values" style="width: 95px;" align="center"><input id="r_delete" type="checkbox" class="rights" <?php if($users_rights['TICKET_DELETE']==6){?>checked<?}?> /></td> 
       <td width="20%" class="enterprise_table_values" style="width: 95px;" align="center"><input id="r_reopen" type="checkbox" class="rights" <?php if($users_rights['TICKET_REOPEN']==6){?>checked<?}?> /></td> 
       <td width="20%" class="enterprise_table_values" style="width: 95px;" align="center"><input type="checkbox" class="rights" onclick="enable_checkboxes(this.value)" value="0" /></td> 
       </tr> 
       </table> 
       <table> 
        <tr> 
         <?php $_SESSION['useridnum'];?> 
         <td> 
          <input type="Submit" name="rightssubmit" id="rightssubmit" value="Update"> 

         </td> 
        </tr> 
       </table> 
       </div> 
      </td> 
      </tr> 
      </table> 
      <? $circulars_listing_rows=mysql_query($circulars_query_for_pagination); 
       $totalrows=mysql_num_rows($circulars_listing_rows); 
       if($totalrows==0)$page=0; 
       $lastpage = ceil($totalrows/$preffered_rows_perpage); 
       include '../common/pagination_tkt.php';?> 
      </div> 
     </td> 
     </tr> 
     </table> 
     </form> 

     </div> 
+0

所以,你問如何寫一個AJAX調用一個數據庫,從數據庫提取數據,並張貼此頁面上? – TimSPQR

回答

0

如果您想通過jQuery.Post發帖,您需要填寫表格ID。

<form id="formtosubmit"> 
    <!-- input and stuff here--> 
</form> 

jQuery的

$('#formtosubmit').submit(function(){ 

    $.post('url/to/post/to.php', $(this).serialize(),function(data){ 
     // Do processing here from return? 
    }); 
    return false; 
}); 

注:你需要給你的每一個輸入的名字。