質問編集履歴

1

sendFile()の追加

2021/05/27 13:47

投稿

saibaiman
saibaiman

スコア0

test CHANGED
File without changes
test CHANGED
@@ -72,6 +72,54 @@
72
72
 
73
73
  });
74
74
 
75
+
76
+
77
+ sendFile = function (file) {
78
+
79
+ form = document.getElementById(id_form);
80
+
81
+ var formData = new FormData(form);
82
+
83
+ formData.set('image', file);
84
+
85
+ $.ajax({
86
+
87
+ type: "POST",
88
+
89
+ url: url,
90
+
91
+ data: formData,
92
+
93
+ async: false,
94
+
95
+ contentType: false,
96
+
97
+ processData: false,
98
+
99
+ success: function (response)
100
+
101
+ {
102
+
103
+ if(response.status == 1){
104
+
105
+ array_image.push(response.id);
106
+
107
+ st_input_receipt = array_image.toString();
108
+
109
+ $(input_receipt).val(st_input_receipt);
110
+
111
+ } else {
112
+
113
+ console.log("error");
114
+
115
+ }
116
+
117
+ }
118
+
119
+ });
120
+
121
+ };
122
+
75
123
  ```
76
124
 
77
125
  ```php