I don't think you can access database directly via JS, because a database is normally meant to be on the server. You might want to have a look at this:stackoverflow.com/questions/2987437/…
You will need a server side language for this. Use AJAX and make a call to a serverside page which can call the procedure and return the response back.