开发者

How can we query using javascript?

开发者 https://www.devze.com 2023-03-03 22:06 出处:网络
Hey! I want to check for a string value from a database without going to another jsp page. Since the server code is executed first I can\'t check it using javascript开发者_StackOverflow社区. Can anyon

Hey! I want to check for a string value from a database without going to another jsp page. Since the server code is executed first I can't check it using javascript开发者_StackOverflow社区. Can anyone help please?


You cannot query a database directly from javascript. Nor should you be able or want to.


Edit: Oh, i'm sorry, i missed that "you can't use javascript". this answer is Javascript based, so might not work for you...

What you could do is to send a ajax request to a servercode page, which handles the request, query the database and check the string and then replies to the javascript whether the string is OK.

Look here: http://api.jquery.com/category/ajax/ or http://www.yourhtmlsource.com/javascript/ajax.html

Good luck!

0

精彩评论

暂无评论...
验证码 换一张
取 消