dear all..i have a textfield. i want after i have typed identity number inside it, the script can identifying to "user table" at DB. i want if id number not match can show an alert.. how do i do that?i'm newbie at javascript
A:
Your JS code should be something like this:
var identityNum = 'xxxxx'; // ajdust value / fetch from db
var val = document.getElementById('input-field-id').value;
if (val === identityNum)
{
// success... your further code
}
else
{
alert('No match found !!');
}
Sarfraz
2010-07-27 04:54:17
A:
so basicly you can split up your problem in two parts:
on the change of your identity field check the user id
$('input#userid').change(function(){ checkUserId( $(this).val() ); });by checking the database
function checkUserId( id ){ $.ajax({ type: 'POST', // or get url: 'some_url.php', data: {userid:id}, success: function(data){ if(data == 'false') alert('Wrong user id'); } }); }someting like that