我正在编写一个应用程序,我想通过减少导航所需的点击量来使用户更加友好。目前页面加载如下:
<a class='pageloader' name='page1.html'>Page 1</a>
<script>
$('.pageloader').click(function(){
// Load the page that the user clicked on by taking the name property and appending it to includes/
$('.content').load("pages/" + this.name);
});
</script>
基本上,这采用点击链接的名称,并将内容 div 的内容替换为文件中与 name 属性匹配的任何内容。
现在我唯一的问题是我无法将人们重定向到使用 HTML 的页面,因为唯一具有正确样式的页面是 index.php。显然,我现在在操作完成后将人们重定向到 index.php,但我想将他们重定向到特定页面。
我想过打电话
$('.content').load('pages/edit-plein.php');
(此代码位于写入文件的 .php 脚本中)
但这只会给我一个错误,因为它找不到 .content div。
有人知道将用户重定向到我想要的页面的好方法吗?