-
Notifications
You must be signed in to change notification settings - Fork 0
/
testformupload.html
35 lines (31 loc) · 1.36 KB
/
testformupload.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<html>
<body>
<h1>form</h1>
<img src="http://localhost:8080/static/uploads/asfa_1615445054190">
<form name="brand" name="uploader" enctype="multipart/form-data" id="form1">
<input type="text" name="brandName"></inpu>
<input name="file" type="file">
<button type="submit" id="btn1">Submit</button>
</form>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script>
$(document).ready(()=>{
$("#form1").on("submit", function(ev) {
ev.preventDefault(); // Prevent browser default submit.
let formData = new FormData(this);
$.ajax({
url: "http://localhost:8080/api/brand/create",
// url: "https://firefly-admin-nodejs-nob8m.ondigitalocean.app/app/api/brand/create",
type: "POST",
data: formData,
success: function (msg) {
console.log(msg)
},
contentType: false,
processData: false
});
});
})
</script>
</body>
</html>