먼저 읽고 우리가 어떤 경로를 설정해야 할 수 있습니다 내부 간단한 코드는 AJAX 기능에 대한이
$('a.ajax').click(function(e){
e.preventDefault();
var pageURL = $(this).attr('href');
$('#divID-to-be-updated').load(pageURL);
});
더 같이 할 수 있습니다. 컨트롤러로도이 작업을 수행 할 수 있습니다.
당신이 블레이드 템플릿을 사용하는 경우
//home.php
<html>
<head>
<script>
$('a.ajax').click(function(e){
e.preventDefault();
var pageURL = $(this).attr('href');
$('#ajaxContent').load(pageURL);
});
</script>
</head>
<body>
<div class="wrapper">
<a href="{{URL::to('someRoute')}}" class="ajax">Click Here</a>
<div id="ajaxContent"></div>
</div>
</body>
</html>
는, 여기 당신은 PrimeFaces Ajax를 사용할 수 있습니다
//main.blade.php
<html>
<head>
@yield('styles')
</head>
<body>
<div class="wrapper">
@yield('content')
</div>
@section('scripts')
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
@show
</body>
</html>
//home.blade.php
@extends('main')
@section('content')
<a href="<?=URL::to('someRoute')?>" class="ajax">Click Here</a>
<div id="ajaxContent"></div>
@stop
@section('scripts')
@parent
$('a.ajax').click(function(e){
e.preventDefault();
var pageURL = $(this).attr('href');
$('#ajaxContent').load(pageURL);
});
@stop
구현이있다 :
홈 뷰를 들어, 나는 스크립트 섹션을 추가 할 것 POLL – Makky