Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- $("form").submit(function(){
- if ($("#username").val() == '' || $("#password").val() == '') {
- alert("Sva polja moraju biti popunjena!");
- event.preventDefault();
- }
- else {
- CheckLogin();
- }
- });
- });
- function CheckLogin() {
- var username = $("#username").val();
- var password = $("#password").val();
- $.ajax({
- url: 'login_autentification.php',
- type: 'GET',
- data: {'username': username, 'password': password},
- dataType: 'json',
- async: false,
- error: function(XMLHttpRequest, textStatus, errorThrown) {
- alert(textStatus +" "+ errorThrown + " " + XMLHttpRequest.responseText);
- },
- success: function (data) {
- if (data=='loginFailed') {
- alert("Neispravno korisničko ime i/ili lozinka!")
- event.preventDefault();
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement