<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$(":button").click(function() {
/* Act on the event */
if($(":input").val() != ""){
alert("your name is " + $(":input").val());
}
});
$(":input").bind("keyup",function(){
$(".info").empty();
if($(this).val() == "") return;
// alert($("#name").val());
$.ajax({
type: ‘get‘,
url: ‘Automatic_prompt_info.php‘,
data: {name: $("#name").val()},
success: function(data){
// alert(data);
var array = new Array();
array = data.split(",");
$(".info").append($("<ul></ul>"));
for(var i=0;i<array.length-1;i++){
$(".info ul").append($("<li>"+array[i]+"</li>"));
}
$(".info ul").on("click",function(event){ //事件委托
$("#name").val($(event.target).text());
$(".info").empty();
})
}
});
});
});
</script>