First off, this group is really not geared toward general AJAX help. That said, it would also be much more effective for you to provide a link to your page, working or not. If we can see the live page, even if it's not working, we can utilize a number of debugging tools against your code, rather than relying on our eyes to find errors.
Jeremy R. Geerdes Generally Cool Guy Des Moines, IA For more information or a project quote: jrgeer...@gmail.com If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church! On Mar 23, 2012, at 9:18 AM, Naveen Raj wrote: > sorry sir i will attach my php and ajax file here ... > my html file > <html> > <head> > <script type="text/javascript"> > function showHint(str) > { > var printWin = window.open("","printSpecial"); > printWin.document.open(); > printWin.document.write("inside the script"); > printWin.document.close(); > 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","http://localhost/ajax/gethint.php?q="+str,true); > xmlhttp.send(); > var printWin = window.open("","printSpecial"); > printWin.document.open(); > printWin.document.write("req send to php"); > printWin.document.close(); > } > </script> > </head> > <body> > > <p><b>Start typing a name in the input field below:</b></p> > <form> > First name: <input type="text" onkeyup="showHint(this.value)" size="20" /> > </form> > <p>Suggestions: <span id="txtHint"></span></p> > > </body> > </html> > > my php file is : > > > <?php > // 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"]; > $hint=""; > //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; > ?> > > but when i type names i cannot see the suggestion .. can u find whats wrong > in this ? > > On Fri, Mar 23, 2012 at 6:00 PM, Jeremy Geerdes <jrgeer...@gmail.com> wrote: > It's tough to say exactly what's going on without being able to see the page > that's causing trouble. However, I would note that using AJAX does not change > the actual HTML document. The changes are done dynamically in the browser. So > you should be able to see the effect in the browser itself, or in the > browser's developer tools (e.g., Firebug), but you won't see it when you view > source. > > Jeremy R. Geerdes > Generally Cool Guy > Des Moines, IA > > For more information or a project quote: > jrgeer...@gmail.com > > If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan > Church! > > On Mar 23, 2012, at 7:01 AM, naveen raj wrote: > > > i am using ajax + php in xampp but i cannot see any change in my html > > document even when the event is made ( option selected ) .. can any > > one help me > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Google AJAX APIs" group. > > To post to this group, send email to > > google-ajax-search-api@googlegroups.com > > To unsubscribe from this group, send email to > > google-ajax-search-api+unsubscr...@googlegroups.com > > To view this message on the web, visit > > http://groups.google.com/group/google-ajax-search-api?hl=en_US > > For more options, visit this group at > > http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Google AJAX APIs" group. > To post to this group, send email to > google-ajax-search-api@googlegroups.com > To unsubscribe from this group, send email to > google-ajax-search-api+unsubscr...@googlegroups.com > To view this message on the web, visit > http://groups.google.com/group/google-ajax-search-api?hl=en_US > For more options, visit this group at > http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en > > > > -- > naveen raj , ceg > > > -- > You received this message because you are subscribed to the Google > Groups "Google AJAX APIs" group. > To post to this group, send email to > google-ajax-search-api@googlegroups.com > To unsubscribe from this group, send email to > google-ajax-search-api+unsubscr...@googlegroups.com > To view this message on the web, visit > http://groups.google.com/group/google-ajax-search-api?hl=en_US > For more options, visit this group at > http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en -- You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group. To post to this group, send email to google-ajax-search-api@googlegroups.com To unsubscribe from this group, send email to google-ajax-search-api+unsubscr...@googlegroups.com To view this message on the web, visit http://groups.google.com/group/google-ajax-search-api?hl=en_US For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en