Ignore:
Timestamp:
Nov 5, 2014 10:51:38 AM (11 years ago)
Author:
namnd
Message:
 
File:
1 edited

Legend:

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

    r396 r412  
    1 $(".btn#add").click(function (){
    2         $('#full_name_err').html("");
    3         $('#login_name_err').html("");
    4         $('#pwd1_err').html("");
    5         $('#pwd2_err').html("");
    6         $('#email_err').html("");
    7         $('#phone_err').html("");
    8     $.ajax({
    9                 url: "quan_tri_vien/them",
    10                 type: "POST",
    11                 data: $("#add_frm").serialize(),
    12                 success: function (data, textStatus, jqXHR)
    13                 {
    14                         result = jQuery.parseJSON(data);
    15                         if (result.success == "1")
    16                         {   
    17                                 filter();
    18                                 $('#addAdmin').modal('hide');
    19                         }
    20                         else
    21                         {
    22                                 for (var key in result.errors)
    23                                 {
    24                                         $('#'+key).html(result.errors[key]);
    25                                 }
    26                         }
    27                        
    28                 },
    29                
    30         });
    31        
    32 });
    33 
    34 $('#editUser').on('show.bs.modal', function(e) {
    35         var id = $(e.relatedTarget).data('us-id');
    36         $.ajax({
    37                 url: "nguoi_dung/id/" + id,
    38                 type: "POST",
    39                 success: function (data, textStatus, jqXHR)
    40                 {
    41                         result = jQuery.parseJSON(data);
    42                         if (result.success=="1")
    43                         {
    44                                 item = result.item;
    45                                 $("#edit_cellphone").val(item['cellphone']);
    46                                 $("#edit_acc_balanced").val(item['acc_balanced']);
    47                         }else
    48                         {
    49                                 console.log("Item not found !");
    50                         }
    51                 }
    52         });
    53        
    54         $(".btn#edit").click(function(){
    55                 $.ajax({
    56                         url: "nguoi_dung/sua/" + id,
    57                         type: "POST",
    58                         data: $("#edit_frm").serialize(),
    59                         success: function (data, textStatus, jqXHR)
    60                         {
    61                                 result = jQuery.parseJSON(data)
    62                                 console.log(result);
    63                                 if (result.success=="1"){
    64                                         filter();
    65                                         $('#editUser').modal('hide');
    66                                 }else
    67                                 {
    68                                         console.log("Edit error !");
    69                                 }
    70                         }
    71                 });
    72         });
    73 });
    74 
    75 $('#deleteUser').on('show.bs.modal', function(e) {
    76         var id = $(e.relatedTarget).data('us-id');
    77         $(".btn#delete").click(function(){
    78                 $.ajax({
    79                         url: "nguoi_dung/xoa/" + id,
    80                         type: "POST",
    81                         success: function (data, textStatus, jqXHR)
    82                         {
    83                                 result = jQuery.parseJSON(data)
    84                                 if (result.success=="1"){
    85                                         filter();
    86                                         $('#deleteUser').modal('hide');
    87                                 }else
    88                                 {
    89                                         console.log("Delete error !");
    90                                 }
    91                         }
    92                 });
    93         });
    94 });
    95 
    961(function($){
    972    $.fn.setCursorToTextEnd = function() {
Note: See TracChangeset for help on using the changeset viewer.