PDA

View Full Version : Verify text input against mysql db



jsnull
09-01-2015, 11:25 AM
Hi ... looking for a javascript routine that, when someone enters a value in a text input box, checks to see if that value is already in a mysql db, and if so provides an alert message. Ideas?

dog
09-04-2015, 09:39 PM
Hi jsnul,

I think it will be hard to check a MySQL database using JS without having a server side script in between. What language are you using on the backend?

One idea is that you could send the value via AJAX to a server-side service that runs the check and responds with the result (true/false)?

Another idea might be to load the data into a JS object on the page (when the page loads) and you could then do the JS check against that while the user is interacting with the input field. It all depends on what the data is, whether it needs to be kept private and how much of it there is.

Cheers,
Laurence