SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Help PHP + AJAX

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Oct 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Help PHP + AJAX

    Hi i am alan
    I'm new using PHP + AJAX

    this is code
    [HIGHLIGHT=HTML4Strict]
    <html>
    <head><title>Master Desain</title>
    <script>
    function showHint(str)
    {
    if (str.length==0)
    {
    document.getElementById("txtHint").innerHTML="";
    return;
    }
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
    }
    xmlhttp.open("GET","getbahan.php?q="+str,true);
    xmlhttp.send();
    }
    </script>
    </head>
    <body>

    <p><b><span class="style17">Ketikan Nama Bahan : </span></b>
    <input type="text" onKeyUp="showHint(this.value)" size="20" />
    </p>
    <p><span class="style17">Suggestions:
    Attached Images Attached Images
    Last edited by Dark Tranquility; Oct 12, 2012 at 02:49.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •