我有使用 Laravel 4 在模态引导程序中调用其他页面的代码。但在一种模式中没有出现另一个页面。以下是我的JavaScript代码:
<script>
$(function() {
//ambil data untuk detail buku
$(".detail-dialog").click(function() {
$('#container-modal-ajax')
.dialog({
modal: true,
title: 'Rincian Buku',
shadow: true,
show:{ effect: "puff", duration: 500 },
hide:{ effect: "puff", duration: 1000 },
overlay: true,
draggable: true,
open: function(){
$.ajax({
url: "/user/home"
});
},
buttons: [
{
text: "ok",
click: function() {
$( this ).dialog( "close" );
}
}
]
});
$("#dialog").load("detail.php", function() {
});
});
});
</script>
如果我在网址 ajax 部分中写下控制器路由是真的吗?
看起来 yu 正在使用 jQuery 进行您的 AJAX 调用,根据他们的文档,该调用默认为 GET 请求。
所以你需要确保你有一个路由设置/用户/家
示例路由为:
Route::get('/user/home', function()
{
return 'User home';
});