Are there JavaScript bindings for MySQL?

后端 未结 9 1950
礼貌的吻别
礼貌的吻别 2020-12-17 00:56

I want to access a MySQL database directly from JavaScript code in an HTML page in Firefox.

Does such a library exist?

To be very clear, CGI+Ajax wil

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-17 01:32

    What you need is a HTTP service that exposes the data you want to fetch with JavaScript.

    A small AJAX oriented server side script (PHP, Perl, Ruby, whatever) that takes a few parameters and does the MySQL query, sending the data to the client in an HTTP-and-JavaScript friendly manner (for example as image/jpeg or JSON).

    You won't be able to set up anything useful (a working, cross-browser solution) that makes MySQL available to JavaScript. JavaScript can do HTTP, and that's about it. Adapt on the server side.

提交回复
热议问题