삭제기능 추가

This commit is contained in:
daniel LEE 2023-11-10 09:40:56 +09:00
parent b27d0de413
commit 33bf406f46
1 changed files with 42 additions and 13 deletions

View File

@ -54,6 +54,28 @@
}); });
}); });
//
$('#delete').on('click', function() {
var formData = new FormData($('#formDelete')[0]);
for (var pair of formData.entries()) {
console.log(pair[0]+ ', ' + pair[1]);
}
$.ajax({
type: "DELETE",
url: '/profile/user/' + $('#did').val(),
data: formData,
contentType: false,
processData: false,
success: function(data, jqXHR, textStatus) {
alert("삭제 OK");
},
error: function(jqXHR, textStatus, error) {
alert("Error " + error);
}
});
});
//
}); });
</script> </script>
@ -66,10 +88,10 @@
가격 <input type="text" id="phone" name="phone" value=""/><br> 가격 <input type="text" id="phone" name="phone" value=""/><br>
별 <input type="text" id="address" name="address" value=""/><br> 별 <input type="text" id="address" name="address" value=""/><br>
이미지 <input type="file" id="upfile" name="upfile"> 이미지 <input type="file" id="upfile" name="upfile">
<button id="add" type="button">Submit</button> <button id="add" type="button">신규추가</button>
</form> </form>
<br><br><br><br><br><br> <br><br><br><br>
<form id="formEdit"> <form id="formEdit">
제품Id <input type="text" id="eid" name="id" value=""/><br> 제품Id <input type="text" id="eid" name="id" value=""/><br>
@ -77,7 +99,14 @@
가격 <input type="text" id="ephone" name="phone" value=""/><br> 가격 <input type="text" id="ephone" name="phone" value=""/><br>
별 <input type="text" id="eaddress" name="address" value=""/><br> 별 <input type="text" id="eaddress" name="address" value=""/><br>
이미지 <input type="file" id="eupfile" name="upfile"> 이미지 <input type="file" id="eupfile" name="upfile">
<button id="edit" type="button">Submit</button> <button id="edit" type="button">수정</button>
</form>
<br><br><br><br>
<form id="formDelete">
제품Id <input type="text" id="did" name="id" value=""/><br>
<button id="delete" type="button">삭제</button>
</form> </form>
</body> </body>