4차산업혁명의 일꾼/웹개발
스파르타코딩 웹개발 4주차
르무엘
2021. 8. 19. 14:09
1. 전화번호형식 적용법
var regExpPhone = /^\d{2,4}-\d{3,4}-\d{4}$/;
if(!regExpPhone.test(phone)){
alert("전화번호 형식이 올바르지 않습니다.");
return false;
}
2.ajax GET 형식
$.ajax({
type: "GET",
url: "/order",
data: {},
success: function (response) {
console.log(response)
})
3.ajax POST형식
$.ajax({
type: "POST",
url: "/order",
data: {name_give: name, count_give: count, address_give: address, phone_give: phone},
success: function (response) {
if (response["result"] == "success") {
alert(response["msg"]);
// 윈도우 리로드
window.location.reload();
}
}
})
LIST