简体   繁体   English

如何在网页的一部分中创建可搜索的数据库?

[英]How do i create a searchable database within a section of a web page?

I'm trying to create a catalogue that site users can search to find products and stores. 我正在尝试创建目录,站点用户可以搜索该目录以查找产品和商店。 However I want the catalogue to be browsable via a portion of a web page without reloading or changing the page every time, because there are nav bars and other contents which i want to remain on the page and because reload is way too slow and unseemly. 但是,我希望目录可以通过网页的一部分浏览,而不必每次都重新加载或更改页面,因为我想保留在页面上的导航栏和其他内容,以及重新加载的速度太慢且不太合理。

The necessary components: 1. I want the catalogue to be browsable either by a search bar, or by clicking on predefined categories displayed within the "frame" of the catalogue. 必要的组件:1.我希望通过搜索栏或单击目录“框架”中显示的预定义类别来浏览目录。 2. I want to be able to apply filters to results via a pane external to the catalogue but on the same page. 2.我希望能够通过目录外部但在同一页面上的窗格将过滤器应用于结果。

So let's say i have categories: 假设我有以下类别:

Health Home Finance etc. 保健之家金融等

Displayed in the "frame." 显示在“框架”中。

How could i make it so a user could click on one of those categories and the database search results of that category would populate in that space, which would be filtered into further sub categories which could also be clicked? 我如何做到这一点,以便用户可以单击这些类别之一,并且该类别的数据库搜索结果将填充在该空间中,该空间将被过滤成其他也可以单击的子类别?

So basically i want database navigation within a portion of a web page. 所以基本上我想在一部分网页内进行数据库导航。

How can i do this without using iframe? 不使用iframe怎么办? Ajax or something? 阿贾克斯还是什么?

I feel like there's a really easy way but I'm not familiar enough with web development yet to know... 我觉得有一种非常简单的方法,但是我对Web开发还不十分了解...

Thanks for all the help! 感谢您的所有帮助!

What you described is one of the classic problems that made ajax as popular as it is today. 您所描述的是使ajax像今天一样流行的经典问题之一。 One of the ways you could handle this is to make a php script that upon call would generate a portion of the website and you would just place it wherever you want. 处理此问题的方法之一是制作一个php脚本,该脚本可在调用时生成网站的一部分,并且可以将其放置在所需的任何位置。 Another approach is to give back data (JSON is de facto standard for this) and render it with javascript in the browser. 另一种方法是返回数据(JSON是事实上的标准),并在浏览器中使用javascript进行渲染。 If you want anything more concrete you will need to give us code samples of what's happening. 如果您需要更具体的信息,则需要向我们提供正在发生的事情的代码示例。

Read on: W3 , tutsplus - ajax 继续阅读: W3tutsplus-Ajax

You might want to poke around in DataTables source as this script incorporates everything you mentioned before: php, js, ajax, db 您可能想在DataTables源代码中四处寻找,因为此脚本包含了您之前提到的所有内容:php,js,ajax,db

On a side note: ajax handles content changes in a much more beautiful manner then (i)frames and I always suggest to move away from them. 附带说明:与(i)框架相比,ajax以更漂亮的方式处理内容更改,我总是建议您远离它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM