2014-12-03 26 views
-1

我想用PHP做一個AJAX代碼。jQuery AJAX格式 - HTML PHP格式自動更改後加載

主要PHP代碼是here

並且支持PHP代碼(每次加載AJAX)是here

AJAX加載完美。

但它沒有完全加載。

什麼AJAX是應該做的每一次是給這種類型的代碼 -

   <tr> 
        <form action="update" method="post"> 
         <th nowrap=""><?php echo '<a href="profile/'.$row_list['vanity_url'].'" target="_new">'.substr($row_list['name'],0,15).'</a>'; ?></th> 
         <th ><input type="text" readonly value='<?php echo $row_list['vanity_url']; ?>' class="login-text name right10 form-control" style="width: 600px" id="registerCompany" name="old"></th> 
         <th nowrap=""><br/></th> 
         <th ><input type="text" class="login-text name right10 form-control" style="width: 600px" id="registerCompany" name="new" placeholder="*New URL" required autocomplete="off" ></th> 
         <th nowrap=""><br/></th> 
         <th nowrap=""><button type="submit" class="btn btn-primary">Update</button></th> 
        </form> 
       </tr> 

但它不給這個。它是給

    <tr> 
        <form action="update" method="post"></form> 
         <th nowrap=""><?php echo '<a href="profile/'.$row_list['vanity_url'].'" target="_new">'.substr($row_list['name'],0,15).'</a>'; ?></th> 
         <th ><input type="text" readonly value='<?php echo $row_list['vanity_url']; ?>' class="login-text name right10 form-control" style="width: 600px" id="registerCompany" name="old"></th> 
         <th nowrap=""><br/></th> 
         <th ><input type="text" class="login-text name right10 form-control" style="width: 600px" id="registerCompany" name="new" placeholder="*New URL" required autocomplete="off" ></th> 
         <th nowrap=""><br/></th> 
         <th nowrap=""><button type="submit" class="btn btn-primary">Update</button></th> 
       </tr> 

所以,窗體關閉,所以它不能使用。

任何人都可以幫助我嗎?

在此先感謝您的幫助。

+0

您返回的HTML無效。 檢查此答案http://stackoverflow.com/questions/1249688/html-is-it-possible-to-have-a-form-tag-in-each-table-row-in-a-xhtml-valid -辦法 – 2014-12-03 19:37:54

回答

0

嘗試使用此代碼

while($row_list=mysqli_fetch_array($query)) 
     { ?> 
      <tr> 
       <td> 
        <form action="update" method="post"> 
         <table style="width:100%"> 
          <tr> 
           <td nowrap=""> <?php echo '<a href="profile/'.$row_list['vanity_url'].'" target="_new">'.substr($row_list['name'],0,15).'</a>'; ?> </td> 
           <td>   <input type="text" readonly value='<?php echo $row_list['vanity_url']; ?>' class="login-text name right10 form-control" style="width: 600px" id="registerCompany" name="old"> </td> 
           <td>   <input type="text" class="login-text name right10 form-control" style="width: 600px" id="registerCompany" name="new" placeholder="*New URL" required autocomplete="off" > </td>  
           <td nowrap=""> <button type="submit" class="btn btn-primary">Update</button>  </td> 
          </tr> 
         </table> 
        </form> 
       </td> 
      </tr> 
<?php } 

認爲這將是解決了。