1 | $(document).on('change', '.upload', function() {
|
---|
2 | var path = this.value;
|
---|
3 | var filename = path.replace(/^.*\\/, "");
|
---|
4 | $("#input-upload").val(filename);
|
---|
5 | });
|
---|
6 |
|
---|
7 | $(document).ready(function(){
|
---|
8 |
|
---|
9 | $('#btn-submit').click(function(){
|
---|
10 | $("#charging").css('display', 'block');
|
---|
11 | $("#result").html("");
|
---|
12 | var data = new FormData($("#frm-upload")[0]);
|
---|
13 | //console.log(data);
|
---|
14 | $.ajax({
|
---|
15 | url: '/collaborator/user/upload',
|
---|
16 | type: 'POST',
|
---|
17 | data: data,
|
---|
18 | dataType: 'json',
|
---|
19 | mimeType: "multipart/form-data",
|
---|
20 | contentType: false,
|
---|
21 | processData: false,
|
---|
22 | cache: false,
|
---|
23 | success: function(data){
|
---|
24 | $("#charging").css('display', 'none');
|
---|
25 | $("#result").html(data);
|
---|
26 | },
|
---|
27 | error: function(data){
|
---|
28 | }
|
---|
29 | });
|
---|
30 | return false;
|
---|
31 | });
|
---|
32 |
|
---|
33 | });
|
---|
34 |
|
---|
35 | function changePassword(collaborator_id)
|
---|
36 | {
|
---|
37 | $('#passwd_old_err').html("");
|
---|
38 | $('#passwd_new_err').html("");
|
---|
39 | $('#confirm_passwd_new_err').html("");
|
---|
40 | $.ajax({
|
---|
41 | url: '/collaborator/collaborator/change_password/' + collaborator_id,
|
---|
42 | type: 'POST',
|
---|
43 | data: $("#frm-change-password").serialize(),
|
---|
44 | success: function (data, textStatus, jqXHR)
|
---|
45 | {
|
---|
46 | console.log(data);
|
---|
47 | result = jQuery.parseJSON(data);
|
---|
48 | if (result.success == "1")
|
---|
49 | {
|
---|
50 | $("#changePassSuccess").modal('show');
|
---|
51 | }
|
---|
52 | else
|
---|
53 | {
|
---|
54 | for (var key in result.errors)
|
---|
55 | {
|
---|
56 | $('#'+key).html(result.errors[key]);
|
---|
57 | }
|
---|
58 | }
|
---|
59 | }
|
---|
60 | });
|
---|
61 | }
|
---|