2009-07-16 3 views
0

data.php 사용자가 데이터베이스를 업데이트 할 때 jquery로 백그라운드에서 데이터베이스가 업데이트되지만 응답으로 데이터가 업데이트 된 특정 테이블을 다시로드하려고합니다.jquery를 통해 동일한 파일의 요소를로드하는 중

내 HTML :

<div id="divContainer"> 
<table id="tableContainer" cellspacing='0' cellpadding='5' border='0'> 
<tr> 
    <td>No.</td> 
    <td>Username</td> 
    <td>Password</td> 
    <td>Usage Left</td> 
    <td>%</td> 
</tr><!-- Multiple rows with different data (This is head of table) --> 

내 JQuery와 : 모든 것이 잘 작동

$('#UpdateAll').click(function() { 
      $.ajax({ 
      type: 'post', 
      url: 'update.php', 
      data: 'action=updateAll', 

      success: function(response) { 
       $('#response').fadeOut('500').empty().fadeIn('500').append(response); 

       $('<div id="divContainer" />').slideUp('500').empty().load('data.php #tableContainer', function() { 
        $(this).hide().appendTo('#divContainer').slideDown('1000'); 
       }); 
      } 
      });  
     }); 

데이터베이스가 업데이트지고 성공 #response에 성공 메시지 만로드지고 테이블이 새로 고쳐지지 않습니다.

답변

0
 $('#UpdateAll').click(function() { 
     $.ajax({ 
     type: 'post', 
     url: 'update.php', 
     data: 'action=updateAll', 

     success: function(response) { 
      $('#response').fadeOut('500').empty().fadeIn('500').append(response); 

      $('#divContainer').slideUp('1000').load('data.php #tableContainer', function() { 
       $(this).hide().appendTo('#tableContainer').slideDown('1000'); 
      }); 
     } 
     });  
    }); 
+0

그것은 먼저이 같은 보았다 질문에서 중복 된 필요

$('<div id="divContainer " />').slideUp.... 

다시이 요소를 작성하는 , 그러나 가까운 검사에서 나는 약간의 차이를 본다. 이것이 작동하도록 바꾸 었는지 나타 내기 위해 이것을 편집 할 수 있습니까? –

0

은 이미 divContainer의 ID로 사업부가 있지만 당신은 당신이

$('#divContainer') 
     .slideUp('500') 
     .empty() 
     .load('data.php #tableContainer', function() { 
      $(this).slideDown('1000'); 
      }); 
관련 문제