-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregistracija.js
64 lines (53 loc) · 1.58 KB
/
registracija.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// JavaScript Document
function provjeri_dostupnost()
{
var zahtjev=new ajaxZahtjev();
var username_tmp=document.getElementById("username").value;
if (username_tmp=="")
{
document.getElementById("username_opis").innerHTML="";
return;
}
zahtjev.open("POST","provjeri_username.php",true);
zahtjev.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
zahtjev.onreadystatechange=function()
{
if (this.readyState==4 && this.status==200)
{
if (this.responseText=="dostupno")
{
document.getElementById("username_opis").innerHTML="Dostupno :)";
document.getElementById("dugme").disabled="";
}
else
{
document.getElementById("username_opis").innerHTML="Nije dostupno :(";
document.getElementById("dugme").disabled="true";
}
}
}
if (username_tmp!="")
{
var parametri="username="+username_tmp;
zahtjev.send(parametri);
}
}
function provjeri_podatke()
{
var poruka="";
var podaciOK=true;
var ime=document.getElementById("ime").value;
var prezime=document.getElementById("prezime").value;
var username=document.getElementById("username").value;
var password=document.getElementById("password").value;
if (ime=="") { poruka+="ime"; podaciOK=false; }
if (prezime=="") { poruka+=", prezime"; podaciOK=false; }
if (username=="") { poruka+=", username"; podaciOK=false; }
if (password=="") { poruka+=", password"; podaciOK=false; }
if (!podaciOK)
{
if (poruka.charAt(0)==",") poruka=poruka.substr(2);
poruka="Niste unijeli " + poruka + "!";
alert(poruka);
}
}