• 회원가입
  • 로그인
  • 구글아이디로 로그인

[AJAX] JS - AJAX - ASP 아작스 예제 (= 입력제시어 = 입력예제)

PHP와 작동 메커니즘 동일

https://homzzang.com/b/js-84

 


b.asp

<p>제시어: <span id="txtHint"></span></p> 


<p>입력: <input type="text" id="txt1" onkeyup="hz(this.value)"></p>


<script>

function hz(str) {

  var xhttp;

  if (str.length == 0) { 

    document.getElementById("txtHint").innerHTML = "";

    return;

  }

  xhttp = new XMLHttpRequest();

  xhttp.onreadystatechange = function() {

    if (this.readyState == 4 && this.status == 200) {

      document.getElementById("txtHint").innerHTML = this.responseText;

    }

  };

  xhttp.open("GET", "a.asp?q="+str, true);

  xhttp.send();

}

</script>


 

a.asp

 

<%

response.expires=-1

dim a(2)

a(1)="홈짱닷컴"

a(2)="Homzzang.com"


q=ucase(request.querystring("q"))


if len(q)>0 then

  hint=""

  for i=1 to 2

    if q=ucase(mid(a(i),1,len(q))) then

      if hint="" then

        hint=a(i)

      else

        hint=hint & " , " & a(i)

      end if

    end if

  next

end if


if hint="" then

  response.write("제시어 없음")

else

  response.write(hint)

end if

%>

 

 

 

방문 감사합니다. (즐겨찾기 등록: Ctrl + D)

분류 제목
AJAX JS - AJAX (아작스) 소개
AJAX JS - AJAX - XMLHttpRequest() 메서드 ★ - 객체생성 (= 아작스/에이잭스 핵심 = X…
AJAX JS - AJAX - open()/send() 메서드 ★ - 서버에 요청 보내기 (GET방식 vs POST방…
AJAX JS - AJAX - Server Response (서버응답) - 콜백함수 사용 예제
AJAX JS - AJAX - XML 아작스 예제 (= xml 데이터 불러와 표만들기)
AJAX JS - AJAX - PHP 아작스 예제 ★ (= 입력제시어 = 입력예제)
AJAX JS - AJAX - ASP 아작스 예제 (= 입력제시어 = 입력예제)
AJAX JS - AJAX - DB 아작스 예제 ★ (= 데이터베이스 정보 가져오기) ※ select 태그 optio…
목록
찾아주셔서 감사합니다. Since 2012