Php Laravel 5.2无页面刷新的深度链接
我是新来的拉威尔,可能有一些很好的例子,如何实现它的深层链接? 我正在尝试这样实现smth: 我添加了上面示例中的所有js脚本,但没有任何效果,它会像以前一样刷新,我还应该做什么 救命啊 UPD: JS脚本:Php Laravel 5.2无页面刷新的深度链接,php,jquery,ajax,laravel-5.2,Php,Jquery,Ajax,Laravel 5.2,我是新来的拉威尔,可能有一些很好的例子,如何实现它的深层链接? 我正在尝试这样实现smth: 我添加了上面示例中的所有js脚本,但没有任何效果,它会像以前一样刷新,我还应该做什么 救命啊 UPD: JS脚本: $.address.init(function() { // Initializes plugin support for links $('a:not([href^=https])').address(); // Adds a simple hover effect $('.nav
$.address.init(function() {
// Initializes plugin support for links
$('a:not([href^=https])').address();
// Adds a simple hover effect
$('.nav a').hover(function() {
$(this).addClass('hover');
}, function() {
$(this).removeClass('hover');
});
}).change(function(event) {
// Identifies the page selection
var page = event.parameters.page ? '/?page=' + event.parameters.page : event.path;
// Highlights the selected link
$('.nav a').each(function() {
if ($(this).attr('href') == (page == '/' ? '#' : '#!' + page)) {
$(this).addClass('selected').focus();
} else {
$(this).removeClass('selected');
}
});
var handler = function(data) {
$('.content').html($('.content', data).html()).parent().show();
$.address.title(/>([^<]*)<\/title/.exec(data)[1]);
};
// Loads the page content and inserts it into the content area
$.ajax({
url: location.pathname + '?_escaped_fragment_=' + encodeURIComponent(event.value),
error: function(XMLHttpRequest, textStatus, errorThrown) {
handler(XMLHttpRequest.responseText);
},
success: function(data, textStatus, XMLHttpRequest) {
handler(data);
}
});
});
// Hides the page during initialization
document.write('<style type="text/css"> .page { display: none; } </style>');
$.address.init(函数(){
//初始化对链接的插件支持
$('a:not([href^=https])).address();
//添加一个简单的悬停效果
$('.nav a').hover(函数(){
$(this.addClass('hover');
},函数(){
$(this.removeClass('hover');
});
}).更改(功能(事件){
//标识页面选择
var page=event.parameters.page?'/?page='+event.parameters.page:event.path;
//突出显示选定的链接
$('.nav a')。每个(函数(){
if($(this.attr('href')==(第=='/'?':'!'+页)){
$(this.addClass('selected').focus();
}否则{
$(this.removeClass('selected');
}
});
变量处理程序=函数(数据){
$('.content').html($('.content',data.html()).parent().show();
$.address.title(/>([^Post您已经编写/正在使用的代码--如果不看到您正在使用的代码,很难帮助您…很抱歉延迟,请告诉我,我更新了main Post,可以通过点击
标签进行交互的javascript在哪里?如果您不想刷新页面,您需要使用ajax来获取内容Post您已经编写/正在使用的代码--在没有看到你正在做什么的情况下很难帮助你…很抱歉耽搁了你,我更新了main post。点击
标签可以交互的javascript在哪里?如果你不想刷新页面,你需要使用ajax来获取内容
Route::get('/', 'PagesController@home');
Route::get('/estates', 'PagesController@estates');
Route::get('/addEstate', 'PagesController@addEstate');
Route::get('/contact', 'PagesController@contact');
Route::get('/register', 'PagesController@register');
$.address.init(function() {
// Initializes plugin support for links
$('a:not([href^=https])').address();
// Adds a simple hover effect
$('.nav a').hover(function() {
$(this).addClass('hover');
}, function() {
$(this).removeClass('hover');
});
}).change(function(event) {
// Identifies the page selection
var page = event.parameters.page ? '/?page=' + event.parameters.page : event.path;
// Highlights the selected link
$('.nav a').each(function() {
if ($(this).attr('href') == (page == '/' ? '#' : '#!' + page)) {
$(this).addClass('selected').focus();
} else {
$(this).removeClass('selected');
}
});
var handler = function(data) {
$('.content').html($('.content', data).html()).parent().show();
$.address.title(/>([^<]*)<\/title/.exec(data)[1]);
};
// Loads the page content and inserts it into the content area
$.ajax({
url: location.pathname + '?_escaped_fragment_=' + encodeURIComponent(event.value),
error: function(XMLHttpRequest, textStatus, errorThrown) {
handler(XMLHttpRequest.responseText);
},
success: function(data, textStatus, XMLHttpRequest) {
handler(data);
}
});
});
// Hides the page during initialization
document.write('<style type="text/css"> .page { display: none; } </style>');