Ajax Request

<script language="javascript" type="text/javascript">
 
    function PostSubmitdata() {
        var flag = true;
        var reqcode = $('#Code').val();
        var requserid = $('#UserId').val();
        var reqpassword = $('#Password').val();
        var reqconfirmpassowrd = $('#ConfirmPassword').val();
        var reqid = $('#UserId').val();
 
        var l = Ladda.create(document.querySelector('.ladda-button'));
        l.start();
 
        l.isLoading();
        l.setProgress(0 - 1);
            //$.ajax({
            //    // async: true,
 
            //    type: "POST",
            //    url: '',
            //    dataType: "json",
            //    data: { UserId: requserid, Password: reqpassword, ConfirmPassword: reqconfirmpassowrd, Code: reqcode },
            //    context: document.body,
 
            //    // contentType: 'application/json; charset=utf-8'
            //}).success(function (data) {
            //    l.stop();
            //    $("#msg").html('<font color="green">Your password successfully changed!</font>');
            //}).error(function (jqXHR, exception) {
            //    l.stop();
            //    if (jqXHR.status === 0) {
            //        alert('Not connect.\n Verify Network.');
            //    } else if (jqXHR.status == 404) {
            //        alert('Requested page not found. [404]');
            //    } else if (jqXHR.status == 400) {
            //        $("#msg").html('<font color="red">Invalid Request</font>');
            //    } else if (jqXHR.status == 500) {
            //        alert('Internal Server Error [500].');
            //    } else if (exception === 'parsererror') {
            //        alert('Requested JSON parse failed.');
            //    } else if (exception === 'timeout') {
            //        alert('Time out error.');
            //    } else if (exception === 'abort') {
            //        alert('Ajax request aborted.');
            //    } else {
            //        alert('Uncaught Error.\n' + jqXHR.responseText);
            //    }
            //});
    }
    $('#btnReset').click(function () {
        if (validateSubmitdata() != false) {
            PostSubmitdata();
        }
    });
    function validateSubmitdata() {
        if ($("#Password").val() == '') {
            $('#Password').css("border""#FF0000 solid 1px");
            return false;
        }
        if ($("#ConfirmPassword").val() == '') {
            $('#ConfirmPassword').css("border""#FF0000 solid 1px")
            return false;
        }
 
        if ($("#Password").val() !== ($("#ConfirmPassword").val())) {
 
            $('#msg').html('<font color="red">Your password does not match</font>');
            $("#Password").val('');
            $("#ConfirmPassword").val('');
            $('#Password').css("border""#FF0000 solid 1px")
            $('#ConfirmPassword').css("border""#FF0000 solid 1px")
            $("#Password").focus();
            return false;
        }
        else {
            if ($("#Password").val().length < 6) {
                $('#msg').html('<font color="red">The New Password must be at least 6 characters long.</font>');
                return false;
            }
        }
        return true;
    }
 
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Ladda/0.9.8/spin.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ladda-bootstrap/0.9.4/ladda.min.js"></script>

Search This Blog

Arsip Blog

Powered by Blogger.

Recent

Comment

Author Info

Like This Theme

Popular Posts

Video Of Day

Sponsor

Most Popular