1
我想获得响应内Ajax JqueryUi自动完成,但我不能在下拉框中得到结果。这里是脚本=>jqueryui自动完成与Ajax响应
$(function(){
$("#user_key").autocomplete({
source: function(){
var http = false;
if (window.XMLHttpRequest){
http = new XMLHttpRequest();
} else {
http = new ActiveXObject("Microsoft.XMLHTTP");
}
if (http){
http.open("POST","./ajax/autocomplete.php",true);
http.onreadystatechange = function(){
if (http.status==200 && http.readyState==4){
this.value = http.responseText;
}
};
http.send(null);
}
},
close: function(){
}
});
});
在
autocomplete.php
例如简化为只写了<?php echo "hello"; ?>
我怎样才能得到这个下拉框中的“hello”,为什么它是需要使用接近:在底部功能感谢:)
PS。我认为我在编写this.value时错了= http.responseText,例如在写alert(http.responseText)时它会从.php文件中得到结果。我怎么能指出结果写在下拉框?
如果你使用jQuery,使用'$。员额()'或'$。阿贾克斯()'方法来做AJAX。 – Matt 2012-08-02 17:41:11
P.S.你有没有完全阅读[jQuery UI自动完成文档](http://jqueryui.com/demos/autocomplete/)? – Matt 2012-08-02 17:43:03
事实上,我不知道jquery的Ajax,并且因为我有这样的脚本 – tnanoba 2012-08-02 17:47:47