해당 페이지의 링크를 클릭하면 인덱스 페이지로 데이터를 보내려고합니다. 의 index.php 페이지는 다음과 같습니다
나는 새로운 링크를 그런 식으로 페이지를 다시로드 할<script>
jQuery('.show_content').click(function(e)
{
e.preventDefault();
var href = jQuery(this).attr('href');
jQuery.post(window.location, { link: href });
});
</script>
이는로드 :
include "../app/bootstrap.php";
include ("../src/controllers/DisplayContentsController.php");
$data = new DisplayContentsController();
$link = (isset($_POST['link']) ? $_POST['link'] : null);
if ($link != null)
{
$data->show($twig, $starting_file_path . '/' . $link);
$starting_file_path = $starting_file_path . '/' . $link;
}
else
{
$data->show($twig, $starting_file_path);
}
및로드 된 나뭇 가지 템플릿에 나는이가 올바른 디렉토리. 그러나 내가 jQuery.post()
을 표시하면 표시된 내용이 변경되지 않습니다. 누군가가 내 잘못을 알아 내고이를 어떻게 수행 할 수 있습니까?
무언가를 추가하기 만하면 콘텐츠 요청은 GET에 의해 관리되어야하며 변경 사항은 POST에 의해 두 번 관리해서는 안됩니다. – JorgeeFG