1 | function updateInfo(us_id){
|
---|
2 | $("#updating").css("display", "block");
|
---|
3 | $.ajax({
|
---|
4 | url: 'update_user/' + us_id,
|
---|
5 | type: 'POST',
|
---|
6 | data: $("#frm1").serialize(),
|
---|
7 | success: function (data, textStatus, jqXHR)
|
---|
8 | {
|
---|
9 | $("#updating").css("display", "none");
|
---|
10 | result = jQuery.parseJSON(data);
|
---|
11 | if (result.success == "1")
|
---|
12 | {
|
---|
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 | });
|
---|
18 | }
|
---|
19 | else
|
---|
20 | {
|
---|
21 | for (var key in result.errors)
|
---|
22 | {
|
---|
23 | $('#'+key).html(result.errors[key]);
|
---|
24 | }
|
---|
25 | }
|
---|
26 | }
|
---|
27 | });
|
---|
28 | }
|
---|
29 | $( "#package_register" ).submit(function( event )
|
---|
30 | {
|
---|
31 | $.ajax({
|
---|
32 | url: $(this).attr("action"),
|
---|
33 | type: "POST",
|
---|
34 | data: $("#package_register").serialize(),
|
---|
35 | success: function (data, textStatus, jqXHR)
|
---|
36 | {
|
---|
37 |
|
---|
38 | var results= jQuery.parseJSON(data);
|
---|
39 | $('#package_register_modal').replaceWith(results.modal);
|
---|
40 | $('#package_register_modal').modal('show');
|
---|
41 | },
|
---|
42 | error: function (jqXHR, textStatus, errorThrown)
|
---|
43 | {
|
---|
44 | $(".ajaxloading").hide();
|
---|
45 | }
|
---|
46 | });
|
---|
47 | event.preventDefault();
|
---|
48 | });
|
---|
49 |
|
---|
50 | function 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 |
|
---|
77 | function 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 | }); |
---|