Using javascript
How to access the data base using java script.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Murugesh P85 reputationPosted Jan 7, 2015, 3:11 AM EST
You can use Ajax method to access your Data Access Layer, which in turn access data base.
Suraj SahooRank #382 · 6.6K reputationPosted Jan 12, 2015, 10:33 PM EST
Some what like below:
$.ajax({ url:"/CONTROLLER/ACTION", type:"GET" //since you are fetching(POST if you are posting/sending data to server), success: function(data){ //here data is the records fetched from db/server $("#ANYID").html(data); } });This would help you access database from javascript. Remember by default ajax call is asynchronous, to make it synchronous add
async:false inside ajax call.
I hope this helps.
Thanks.