ȸ¿ø°¡ÀԡžÆÀ̵ð/ºñ¹øã±â
ȨÀ¸·Î


[Ajax] ajax ¿¹Á¦1
9³â Àü
test1.php

<form>
First Name : <input type="text" id="txt1" onkeyup="showHint(this.value)">
</form>
<p>Suggestions : <span id="txtHint"></span></p>


<script>

function showHint(str)
{

        if(str.length==0)
        {
                document.getElementById("txtHint").innerHTML="";
                return;
        }

        xmlHttp = GetXmlHttpObject();
        if(xmlHttp==null)
        {
                alert ("Your browser does not support AJAX!");
                return;
        }

        var url="time.php";
        url=url+"?q="+str;
        url=url+"&sid="+Math.random();
        xmlHttp.onreadystatechange=stateChanged;
        xmlHttp.open("GET",url,true);
        //# true ÀÌ¸é ºñµ¿±â½Ä ó¸®, send() ¸Þ¼Òµå ½ÇÇà½Ã ¼­¹ö¿¡ ¿äûÈÄ ¼­¹öÀÇ ÀÀ´äÀ»
        //# ±â´Ù¸®Áö ¾Ê°í ¹Ù·Î ´ÙÀ½ ÀÚ¹Ù½ºÅ©¸³Æ® ½ÇÇàµÊ
        xmlHttp.send(null);
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
}
catch (e)
{
  // Internet Explorer
  try
  {
   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch (e)
  {
   xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
}
return xmlHttp;
}


function stateChanged()
{
        if (xmlHttp.readyState==4)
        {
                document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
        }
}


</script>

time.php

<?php
header("Cache-Control: no-cache, must-revalidate");
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Fill up array with names
$a[]="Anna";
$a[]="Brittany";
$a[]="Cinderella";
$a[]="Diana";
$a[]="Eva";
$a[]="Fiona";
$a[]="Gunda";
$a[]="Hege";
$a[]="Inga";
$a[]="Johanna";
$a[]="Kitty";
$a[]="Linda";
$a[]="Nina";
$a[]="Ophelia";
$a[]="Petunia";
$a[]="Amanda";
$a[]="Raquel";
$a[]="Cindy";
$a[]="Doris";
$a[]="Eve";
$a[]="Evita";
$a[]="Sunniva";
$a[]="Tove";
$a[]="Unni";
$a[]="Violet";
$a[]="Liza";
$a[]="Elizabeth";
$a[]="Ellen";
$a[]="Wenche";
$a[]="Vicky";//get the q parameter from URL
$q=$_GET["q"];//lookup all hints from array if length of q>0

if (strlen($q) > 0)
{
        $hint="";
        for($i=0; $i<count($a); $i++)
        {
                if (strtolower($q)==strtolower(substr($a[$i],0,strlen($q))))
                {
                        if ($hint=="")
                        {
                                $hint=$a[$i];
                        }
                        else
                        {
                                $hint=$hint." , ".$a[$i];
                        }
                }
        }
}

// Set output to "no suggestion" if no hint were found
// or to the correct values
if ($hint == "")
{
        $response="no suggestion";
}
else
{
        $response=$hint;
}
//output the response
echo $response;
?>
ÃßõÃßõ : 335 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
2,585
HTTP Content-Type Á¤¸®
2,584
PHP ¿¡¼­ ³¯Â¥ Ãâ·ÂÇÒ¶§ »ç¿ëÇÏ´Â ÇÔ¼ö.
2,583
Æ˾÷â °ü·Ã ÀÚ¹Ù½ºÅ©¸³Æ®
2,582
PHP ³¯Â¥/½Ã°£ Á¤¸®
2,581
±ò²ûÇÑ À¥¿ë ½Ã°è´Þ·Â
2,580
PHP¿¡¼­ ¿ø°Ý À̹ÌÁöÀÇ À¯È¿¼ºÀ» üũÇÏ´Â ¹æ¹ý
2,579
Use kakaolink on Android WebView
2,578
Á¤±Ô½Ä ¹®¹ý
2,577
ÇѱÛ, ¿µ¹®, ¼ýÀÚ, Ư¼ö¹®ÀÚ Ã¼Å©ÇÏ´Â ÇÔ¼ö
2,576
ÀÚÁÖ ¾²ÀÌ´Â Á¤±ÔÇ¥Çö½Ä ¸ðÀ½
2,575
[ÀÚ¹Ù½ºÅ©¸³Æ®] ½Ç½Ã°£ ½Ã°è ¸¸µé±â
2,574
¸ð¹ÙÀÏ À¥ÆäÀÌÁö CSS - emÀ» pxó·³ ÆíÇÏ°Ô »ç¿ëÇÏ´Â ¹æ¹ý
2,573
[html5] audio ű׷ΠÀ½¾Ç ÆÄÀÏ »ðÀÔ
2,572
±¸±Û ¾Öµå¼¾½º ÇѱÛ, Çѱ¹ ±¤°í ³ª¿À°Ô ¸¸µé±â
2,571
±Ã±ØÀÇ ¾ÆÀÌÇÁ·¹ÀÓ ³ôÀÌ ÀÚµ¿ Á¶Àý
2,570
PHP·Î Internet Explorer ¹öÀü ¾Ë¾Æ³»±â
2,569
PHP·Î À̹ÌÁö ÁÖ¼Ò ¼û±â±â
2,568
À¯Åõºê ÁÖ¼Ò¿¡¼­ ¾ÆÀ̵𸸠»Ì¾Æ¿À±â
2,567
preg_match_all ¸ÆÁÖ¼Ò ÃßÃâ
2,566
URL¿¡¼­ µµ¸ÞÀθ¸ ÃßÃâÇϱâ
2,565
¸ÞŸÅ±׸¦ ÃßÃâÇØÁÖ´Â get_meta_tags ÇÔ¼ö
2,564
PHP Á¤±Ô½ÄÀ» È°¿ëÇÑ ÅÂ±× ¹× ƯÁ¤ ¹®ÀÚ¿­ Á¦°Å ¹× ÃßÃâ ¹æ¹ý
2,563
preg_match
2,562
À̹ÌÁö Å©±â¸¦ ºñÀ²¿¡ ¸Â°Ô Á¶ÀýÇÑ´Ù.
2,561
$_REQUEST - GET¹æ½Ä,POST¹æ½Ä ±¸ºÐÇÏÁö ¾Ê°í °ª ¹Þ±â
2,560
<UL><LI>¸¦ ÀÌ¿ëÇÑ °¡·ÎÁ¤·Ä ¸Þ´º ¸¸µé±â
2,559
Android KitKat (4.4) video autoplay does not work anymore in webview
2,558
°ü°è ¿¬»êÀÚ
2,557
º´ÇÕ ¿¬»êÀÚ
2,556
SUBSTR ÇÔ¼ö
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.