jQuery("#sendOTP").click(function(){ let phone = jQuery("#phone").val() jQuery.post(ajaxurl,{ action:"send_sms_otp", phone:phone },function(res){ if(res.success){ jQuery("#otpSection").show() alert("ส่ง OTP แล้ว") }else{ alert("ส่ง OTP ไม่สำเร็จ") } }) }) jQuery("#verifyOTP").click(function(){ let phone = jQuery("#phone").val() let otp = jQuery("#otp").val() jQuery.post(ajaxurl,{ action:"verify_sms_otp", phone:phone, otp:otp },function(res){ if(res.success){ jQuery("#otpResult").text("ยืนยันสำเร็จ") }else{ jQuery("#otpResult").text("OTP ไม่ถูกต้อง") } }) })