Ignore:
Timestamp:
Nov 14, 2014 4:19:21 PM (11 years ago)
Author:
namnd
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/assets/js/frontend/user.js

    r490 r502  
    11function updateInfo(us_id){
     2        $("#updating").css("display", "block");
    23        $.ajax({
    34                url: 'update_user/' + us_id,
     
    67                success: function (data, textStatus, jqXHR)
    78                {
     9                        $("#updating").css("display", "none");
    810                        result = jQuery.parseJSON(data);
    911                        if (result.success == "1")
    1012                        {   
    11                                 window.location.reload(true);
     13                                $("#updateInfoSuccess").modal('show');
     14                                //$("#close").click(function(){window.location.reload(true)});
     15                                $('#updateInfoSuccess').on('hidden.bs.modal', function () {
     16                                        window.location.reload(true);
     17                                });
    1218                        }
    1319                        else
     
    4147event.preventDefault();
    4248});
     49
     50function changePassword(us_id)
     51{
     52        $('#passwd_old_err').html("");
     53        $('#passwd_new_err').html("");
     54        $('#confirm_passwd_new_err').html("");
     55        $.ajax({
     56                url: 'change_password/' + us_id,
     57                type: 'POST',
     58                data: $("#frm2").serialize(),
     59                success: function (data, textStatus, jqXHR)
     60                {       
     61                        result = jQuery.parseJSON(data);
     62                        if (result.success == "1")
     63                        {   
     64                                $("#changePassSuccess").modal('show');
     65                        }
     66                        else
     67                        {
     68                                for (var key in result.errors)
     69                                {
     70                                        $('#'+key).html(result.errors[key]);
     71                                }
     72                        }
     73                }
     74        });
     75}
     76
     77function clearFormFields(id){
     78        $(id).find('input:text, input:hidden, input:password, input:file, select, textarea').val('');
     79        $(id).find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected');
     80                $(id).find('.help-block').html("");
     81}
     82
     83$('body').on('hidden.bs.modal', '.modal', function () {
     84        clearFormFields('#frm2');
     85});
Note: See TracChangeset for help on using the changeset viewer.