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

[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;
?>
ÃßõÃßõ : 331 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
2,675
[Shoutcast] ÇöÀç Ç÷¹À̵Ǵ °î¸í ½ºÅ©¸³Æ® PHP
2,674
[Shoutcast] ½ºÆ®¸®¹Ö ³ë·¡Á¦¸ñÀ» º¯°æ ½ºÅ©¸³Æ®
2,673
Shoutcast PHP Scripts
2,672
FTP¿¡¼­ »èÁ¦ ¾ÈµÇ´Â ÆÄÀÏÀ̳ª Æú´õ »èÁ¦Çϱâ
2,671
SHOUTcast ¸¦ ÀÌ¿ëÇÑ ÀÎÅÍ³Ý ¶óÀÌºê ¹æ¼Û ½Ã½ºÅÛ ±¸Ãà
2,670
DAUM ¿ìÆí¹øÈ£ ¼­ºñ½º È°¿ëÇϱâ
2,669
½ÇÇàÁß PHP ¿¡·¯ ¸Þ½ÃÁö ·¹º§ Á¶Á¤Çϱâ
2,668
PHP ÀÎÁ§¼Ç°ú file get contentsÀÇ °ü°è
2,667
¹®ÀÚ¿­ ±ÛÀÚ ¼ø¼­ °Å²Ù·Î µÚÁý±â, ¾ÕµÚ ¹ÝÀü Reverse String
2,666
¹è¿­ ¿ä¼Ò ¼ø¼­ °Å²Ù·Î µÚÁý±â, ¾ÕµÚ ¹ÝÀü Reverse Array
2,665
php ¸Þ¸ð¸® »ç¿ë
2,664
ÀÚ¹Ù½ºÅ©¸³Æ® ³»ºÎ °´Ã¼ º¸±â
2,663
ÀÚ¹Ù ½ºÅ©¸³Æ® ¼ýÀÚ Ã³¸® ÄÞ¸¶ ó¸®
2,662
ÀÚ¹Ù½ºÅ©¸³Æ® Base64 encode, decode
2,661
PHP ¹®ÀÚ¿­ °ü·Ã ÇÔ¼ö
2,660
[php] ¹®ÀÚ¿­À» ³ª´©°Å³ª ÇÕÄ¡´Â explode, implode ÇÔ¼ö
2,659
php ¹®ÀÚ¿­ ÀÚ¸£±â ³ª´©±â ºÐ¸®Çϱâ - explode() , split()
2,658
DB Á¢±Ù ¹× Äõ¸®¹®(insert,select,update,delete)
2,657
[MySQL] Çʵ忡¼­ ƯÁ¤¹®ÀÚ Æ÷ÇÔ ¶Ç´Â Á¦¿ÜÇÑ DB °Ë»ö, LIKE ,NOT
2,656
php5 mysqli µðºñ Á¢¼Ó Ŭ·¡½º ÇÁ·Î±×·¥ ¹× »ç¿ë¹ý
2,655
PHP ¹®ÀÚ¿­ ³ª´©±â - explode()
2,654
[PHP] ¹è¿­ Array
2,653
php ¹è¿­
2,652
[php] Array() ¹è¿­À̶õ?
2,651
PHP ¹è¿­ ÇÔ¼ö Á¤¸®
2,650
PHP ±âº»ÀûÀÎ ¹è¿­ »ç¿ë¹ý
2,649
html¿¡¼­ ÀÔ·ÂÇÑ°ª DB¿¡¼­ ¹Þ¾Æ¿À±â (µµ¼­Á¤º¸ °Ë»ö)
2,648
SQL Äõ¸® Á¤¸®
2,647
[MySql]DB¿¡¼­ ¼­·Î ´Ù¸¥ Å×À̺íÀÇ µ¥ÀÌÅ͸¦ Çѹø¿¡ ºÒ·¯¿À±â
2,646
jquery checkbox Àüü ¼±ÅÃ, Àüü ÇØÁ¦, üũ °ª ÃßÃâ
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.