What do you mean by that? Javascript runs on the client, whereas the DB is on the server. Are you maybe asking : how can Javascript code call server-side code which in turn calls the DB? If so, then a library like jQuery or Prototype may be involved.
Do you mean to connect to database from JavaScript? If that's the case then yes, you can, but it's not recommended to do so (mostly for security issues). It is a bad practice so it would be better to choose a server side language to establish a connection to db.
Also I think there is a separate subforum for these questions (HTML, CSS and JavaScript).
The quieter you are, the more you are able to hear.
In that I created an Ajax form and that Ajax form is having a checkbox which I want to check it when the value in the (Database)table in Y.
so in .js file how can i write the same script for the same.
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
6
posted
0
Vishal Hegde wrote:I created one .js file.
In that I created an Ajax form and that Ajax form is having a checkbox which I want to check it when the value in the (Database)table in Y.
so in .js file how can i write the same script for the same.
JavaScript can not connect directly to the server so you will need to make an Ajax call back to a serverside page that can check the database for you. Other option is to have the page spit out the information you need in a script block when the page is rendering and the script uses that information.