이메일 이름 전화번호 성공_폼 조회하기-테스트 (#10) (#11) (#12) (#13)성명Phone/Mobile이메일<div id="lookup-result" style="display:none; margin: 10px; padding: 10px; border: 1px solid #ccc; background-color: #f9f9f9;"><p style="font-weight: bold;">조회 결과:</p><div id="result-content"></div></div> <script>function waitForElement(selector) {return new Promise(resolve => {if (document.querySelector(selector)) {return resolve(document.querySelector(selector));} const observer = new MutationObserver(mutati {if (document.querySelector(selector)) {observer.disconnect();resolve(document.querySelector(selector));}}); observer.observe(document.body, {childList: true,subtree: true});});} async function initEmailLookup() {// 필요한 필드들을 찾습니다const emailField = await waitForElement('input[name="email"]');const nameField = await waitForElement('input[name="first_name"]');const ph waitForElement('input[name="phone"]');const lookupResult = await waitForElement('#lookup-result'); // 이메일 필드에 blur 이벤트 리스너를 추가합니다emailField.addEventListener('blur', async function() {const email = this.value;if (!email) return; try {// 여기에 본인의 Google Apps Script 웹 앱 URL을 넣으세요const resp fetch('여기에_구글스크립트_URL을_넣으세요?email=' + encodeURIComponent(email));const data = await response.json(); if (data.found) {// 데이터를 찾았을 경우 폼 필드를 채웁니다nameField.value = data.name || '';phoneField.value = data.phone || '';// 조회 결과를 표시합니다lookupResult.style.display = 'block';document.getElementById('result-content').innerHTML = `<p>이름: ${data.name || '없음'}</p><p>전화번호: ${data.phone || '없음'}</p>`;} else {// 데이터를 찾지 못했을 경우lookupResult.style.display = 'block';document.getElementById('result-content').innerHTML = '일치하는 정보를 찾을 수 없습니다.';// 필드를 비웁니다nameField.value = '';phoneField.value = '';}} catch (error) {console.error('조회 중 오류 발생:', error);lookupResult.style.display = 'block';document.getElementById('result-content').innerHTML = '데이터 조회 중 오류가 발생했습니다.';}});} // 스크립트 실행initEmailLookup();</script>Submit Form