I am trying to connect to MySQL Db in the below javascript function.The funcion however does not execute.Can someone please tell me how to connect to MySQL DB and retrieve data through a JS function?
function jsfunction(projectSelected){
alert("hi");
document.getElementById("total").value = projectSelected;
a="hi";
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/service", "root", "root");
Statement st4=con.createStatement();
ResultSet rs4=st4.executeQuery("SELECT * FROM project WHERE project= '"+project_selected+"' " );
String total_amount=rs.getString("total_amount");
}