Skip to content

Instantly share code, notes, and snippets.

@aandr
Created May 2, 2010 16:05
Show Gist options
  • Save aandr/387239 to your computer and use it in GitHub Desktop.
Save aandr/387239 to your computer and use it in GitHub Desktop.
function showUser(str) {
// clear highlights
$('.highlight').removeClass('highlight');
$('#txtHint').load('author-ajax.php?q=' + str, function() {
$('#authors .' + str).addClass('highlight');
});
}
/*
function showUser(str)
51 {
52 if (str=="")
53 {
54 document.getElementById("txtHint").innerHTML="";
55 return;
56 }
57 if (window.XMLHttpRequest)
58 {// code for IE7+, Firefox, Chrome, Opera, Safari
59 xmlhttp=new XMLHttpRequest();
60 }
61 else
62 {// code for IE6, IE5
63 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
64 }
65 xmlhttp.onreadystatechange=function()
66 {
67 if (xmlhttp.readyState==4 && xmlhttp.status==200)
68 {
69 document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
70 }
71 }
72 xmlhttp.open("GET","author-ajax.php?q="+str,true);
73 xmlhttp.send();
74 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment