如何仅使用HTML和JavaScript从MySQL获取数据

时间:2022-12-08 12:25:12

I want to access MySQL database on my local machine only using HTML and JavaScript. I don't want to involve any scripting which would require a webserver. How to achieve this?

我想只使用HTML和JavaScript访问本地机器上的MySQL数据库。我不想涉及任何需要网络服务器的脚本。怎么做到这一点?

3 个解决方案

#1


You're looking for Ajax it seems

你似乎在寻找Ajax

AJAX is the art of exchanging data with a server, and updating parts of a web page - without reloading the whole page.

AJAX是与服务器交换数据和更新网页部分的艺术 - 无需重新加载整个页面。

As @Rayon implied... You will need server side scripting.

正如@Rayon所暗示的那样......您将需要服务器端脚本。

#2


JavaScript can only do stuff on the client ( or Node.js? ). You must use a server-side scripting language like PHP to get information from a MySQL database.

JavaScript只能在客户端(或Node.js?)上做东西。您必须使用PHP等服务器端脚本语言从MySQL数据库中获取信息。

You can use AJAX to pull information.

您可以使用AJAX来提取信息。

#3


You can use node.js for this purpose.

您可以将node.js用于此目的。

#1


You're looking for Ajax it seems

你似乎在寻找Ajax

AJAX is the art of exchanging data with a server, and updating parts of a web page - without reloading the whole page.

AJAX是与服务器交换数据和更新网页部分的艺术 - 无需重新加载整个页面。

As @Rayon implied... You will need server side scripting.

正如@Rayon所暗示的那样......您将需要服务器端脚本。

#2


JavaScript can only do stuff on the client ( or Node.js? ). You must use a server-side scripting language like PHP to get information from a MySQL database.

JavaScript只能在客户端(或Node.js?)上做东西。您必须使用PHP等服务器端脚本语言从MySQL数据库中获取信息。

You can use AJAX to pull information.

您可以使用AJAX来提取信息。

#3


You can use node.js for this purpose.

您可以将node.js用于此目的。