CI 묻고 답하기

제목 jQuery 로 ajax를 쓰려고 합니다.
글쓴이 준피 작성시각 2010/04/26 14:54:27
댓글 : 5 추천 : 0 스크랩 : 0 조회수 : 21210   RSS
http://localhost/test/send/  로컬에서 직접 URL로 접근해도 send라는 컨트롤러의 클래스에 접근을 잘 했습니다.

근데 서버에 올리니까 http://x.x.x.x/test/send/ 에 디렉토리가 없어서 안된다는 에러가 뜨네요

AJAX-for-CodeIgniter v2.zip  위키에 이런게 있던데 설치를 해야되나요?

- views/layouts/default.php 안에 javascript 파일 내용입니다.
$.ajax({
          type: "POST",
          url: "/test/send/",
          dataType: "html",
          success: function(response) {
                    document.getElementById('content').innerHTML = response;
          }
});

- controller/send.php 입니다.
<?php

class Send extends Controller {
   
    function index()
    {
        $this->load->view('send');
    }
}
?>

- views/send.php 입니다.
<div class="send">
        <p>This page is send.</p>
</div>



 다음글 index.php 파일 없애기?..!!(웅파님!수정) (2)
 이전글 checkbox 값 처리에 대한 문의 (4)

댓글

변종원(웅파) / 2010/04/26 15:19:37 / 추천 0
 .htaccess문제 아닌가요? 
브라우저에서 http://x.x.x.x/test/send/  여기 접근은 되는지요?
준피 / 2010/04/26 15:29:04 / 추천 0
.htaccess 를 지운뒤 /test/index.php/send/ 로 접근하면 작동을 합니다.
감사합니다^^


.htaccess는 이렇구요. 어떻게 변경해야되죠?
RewriteEngine on
RewriteCond $1 !^(index\.php|/img|/js|/css|/robots\.txt|/favicon\.ico)
RewriteCond %{REQUEST_URI} !^/js/(.*)$
RewriteRule ^(.*)$ /test/index.php/$1 [L]
변종원(웅파) / 2010/04/26 15:48:35 / 추천 0
system 디렉토리가 어디에 위치해있는지는 모르겠지만

 RewriteRule ^(.*)$ index.php/$1 [L]

이렇게 수정해보세요


준피 / 2010/04/26 15:57:50 / 추천 0
http://x.x.x.x/test/system/ 이렇게 위치해 있습니다.
웅파님께서 알려주신대로 해봤는데 /test/index.php/send/ -> /test/send/ 로 변경하니 안되네요.
혹시 제가 다른설정을 더 해야하나요?
변종원(웅파) / 2010/04/26 21:15:51 / 추천 0

윗글 참고하셔서 htaccess를 수정해보세요. htaccess파일은 ci의 index.php 파일가 동일한
위치에 있어야 합니다.