2012-02-06 3 views
1

나는 사이트를 만들었으며 사용자가 쉽게 관리 할 수 ​​있도록 사이트의 관리 부분을 만들고 있습니다. 기사를 쉽게 수정할 수 있습니다. jeditable을 사용하여 관리자가 정말 사용하기 쉽습니다.jeditable을 사용하여 jquery로 ID 받기하기

JEditable의 일부가 작동하고 있지만 (p 태그가 입력이 됨) Ajax 요청을 통해 제품 ID를 보내는 데 문제가 있습니다.

$(function() { 
     $('.admin_list tr').hover(function() { 
      $('.edit_id').attr('value', $(this).attr('class')); 
     }); 

     $('.editable').editable("http://localhost/monline/private_html/musiconline/?admin/edit/users/" + $('.edit_id').attr('value'), { 
      indicator : 'Saving...', 
      onblur : 'submit', 
      method : 'PUT' 
     }); 
    }); 

당신은 내가의 ID를 얻고있다 볼 수 있듯이 : 여기

<table class="admin_list"> 
     <tr> 
      <th style="width: 110px;">First Name</th> 
      <th style="width: 110px;">Last Name</th> 
      <th style="width: 100px;">Date of Birth</th> 
      <th style="width: 200px;">Email</th> 
      <th style="width: 140px;">Address</th> 
      <th style="width: 112px;">Postal Code</th> 
      <th style="width: 112px;">Town</th> 
      <th style="width: 120px;">Country</th> 
      <th style="width: 115px;">Login</th> 
      <th style="width: 42px;">Action</th> 
     </tr> 

     <tr class="2"> 
      <td><p class="editable">Another</p></td> 
      <td><p class="editable">User</p></td> 
      <td><p class="editable">11/11/1911</p></td> 
      <td><p class="editable">[email protected]</p></td> 
      <td><p class="editable">Address</p></td> 
      <td><p class="editable">56130</p></td> 
      <td><p class="editable">Town</p></td> 
      <td><p class="editable">2</p></td> 
      <td><p class="editable">bob</p></td> 
      <td> 
       <a href="http://localhost/monline/private_html/musiconline/?delete/user/2">D</a> 
       <a href="">U</a> 
       <a href="">D</a> 
      </td> 
     </tr> 

     <tr class="1"> 
      <td><p class="editable">Daniel</p></td> 
      <td><p class="editable">Lucas</p></td> 
      <td><p class="editable">10/04/1990</p></td> 
      <td><p class="editable">[email protected]</p></td> 
      <td><p class="editable">myAddress</p></td> 
      <td><p class="editable">12345</p></td> 
      <td><p class="editable">myTown</p></td> 
      <td><p class="editable">8</p></td> 
      <td><p class="editable">dan</p></td> 
      <td> 
       <a href="http://localhost/monline/private_html/musiconline/?delete/user/1">D</a> 
       <a href="">U</a> 
       <a href="">D</a> 
      </td> 
     </tr> 
    </table> 

    <input type="text" class="edit_id" value="" /> 

내가 작성한 jQuery의 : 여기

내가 현재 (PHP에 의해 생성) 한 HTML 코드입니다 마우스를 가리키면 현재 행 (필자가 피하고 싶습니다), 그러나 페이지를 제출할 때 ID가 jeditable URL에 설정되지 않습니다.

관리자 패널에서 적절한 편집기를 사용하고 싶을 때이를 어떻게 정렬 할 수 있는지 알고있는 사람이 있습니까?

옵션 요청으로 클릭 한 입력을 둘러싼 tr 클래스를 어떻게 얻을 수 있습니까? 나는 $ (이) .parent()의 라인을 따라 뭔가를 시도했습니다. 부모(). ATTR ('클래스')

감사 댄

답변

0

당신이 봤어 (호버 기능이없는, $(this).closest('tr').attr('value')는해야 상대방을 가리키며 <tr>)

$('.editable').editable("http://localhost/monline/private_html/musiconline/?admin/edit/users/" + $(this).closest('tr').attr('value'), { 
     indicator : 'Saving...', 
     onblur : 'submit', 
     method : 'PUT' 
    }); 
+0

답장을 보내 주셔서 감사합니다. url이 " getUrl()."/ "admin? edit/users/')하지만 크롬 네트워크 도구를 사용하여 주소를 추적 할 때? admin/edit/users/undefined – xonorageous

관련 문제