$(document).ready(function() {
        $('#butsave').on('click', function() {
            $("#butsave").attr("disabled", "disabled");

            var username = $('#username').val();
            var password = $('#password').val();

            if (username != "" && password != "") {
                $.ajax({
                    url: "model/login.php?login=true",
                    type: "POST",
                    data: {

                        username: username,
                        password: password,
                    },
                    cache: false,
                    success: function(dataResult) {
                        var dataResult = JSON.parse(dataResult);
                        if (dataResult.statusCode == 200) {
                            $("#butsave").removeAttr("disabled");
                            $('#loginform').find('input:text').val('');
                            $("#success").show();
                            $('#success').html('berhasil login !');
                        } else if (dataResult.statusCode == 201) {
                            alert('Username atau Password tidak sesuai. Silahkan diulang kembali!');  
                            
                        }
                        
                    }
                });
                location.reload();
            } else {
                alert('Username dan password tidak boleh kosong !');
            }
            
          location.reload();
        });
    });
       