How can we query using javascript?
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!
精彩评论