Show
Ignore:
Timestamp:
10/01/08 17:35:19 (3 months ago)
Author:
kenji
Message:

Refactoring Follow/Remove

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/codeigniter/trunk/system/application/views/user/main_friends.php

    r20237 r20373  
    1 <script> 
     1<script type="text/javascript"> 
    22        /* 削除 */ 
    33        function removeFollow(id){ 
    44                if (confirm('削除してもよいですか?取り消しできません!')){ 
    5                         $.post('<?=site_url('friendships/destroy2')?>', {id: id, ticket: $('#ticket').val()}, removeLine, 'html');               
     5                        $.post('<?=site_url('friendships/destroy')?>', {id: id, ticket: $('#ticket').val()}, removeLine, 'json');                
    66                }; 
    77        } 
    8         function removeLine(id){ 
    9                 $('tr').remove(id); 
    10                 count = $('span#count').text() - 1; 
    11                 $('#count').text(count); 
    12                 $('#side_count_friend').text(count); 
     8        function removeLine(data){ 
     9                if (data.status == 'ok') { 
     10                        $('tr').remove(data.id); 
     11                        count = $('span#count').text() - 1; 
     12                        $('#count').text(count); 
     13                        $('#side_count_friend').text(count); 
     14                } 
     15                else { 
     16                        alert(data.html); 
     17                } 
    1318        } 
    1419</script>