I don't really know AJAX, I'm only using a bit of its feature in my project. I used its autocomplete feature in a textfield, which connects to a mysql database. Now I want it so that when a person is selected, his/her corresponding rank (which should also be acquired the database) will automatically be the value of the combobox (something like this)...
我真的不知道AJAX,我只是在我的项目中使用了它的一些功能。我在textfield中使用了自动完成功能,它连接到mysql数据库。现在我想要它,以便当一个人被选中时,他/她的相应等级(也应该被获取数据库)将自动成为组合框的值(类似这样)...
1 个解决方案
#1
0
This tutorial applies a value after select to a text field and the combobox.
本教程将select之后的值应用于文本字段和组合框。
http://www.jensbits.com/2010/03/29/jquery-ui-autocomplete-widget-with-php-and-mysql/
http://www.jensbits.com/2010/03/29/jquery-ui-autocomplete-widget-with-php-and-mysql/
Be sure to check the demo:
一定要查看演示:
http://www.jensbits.com/demos/autocomplete/
http://www.jensbits.com/demos/autocomplete/
$(function() {
$('#abbrev').val("");
$("#state").autocomplete({
source: "states.php",
minLength: 2,
select: function(event, ui) {
$('#state_id').val(ui.item.id);
$('#abbrev').val(ui.item.abbrev);
}
});
$("#state_abbrev").autocomplete({
source: "states_abbrev.php",
minLength: 2
});
});
#1
0
This tutorial applies a value after select to a text field and the combobox.
本教程将select之后的值应用于文本字段和组合框。
http://www.jensbits.com/2010/03/29/jquery-ui-autocomplete-widget-with-php-and-mysql/
http://www.jensbits.com/2010/03/29/jquery-ui-autocomplete-widget-with-php-and-mysql/
Be sure to check the demo:
一定要查看演示:
http://www.jensbits.com/demos/autocomplete/
http://www.jensbits.com/demos/autocomplete/
$(function() {
$('#abbrev').val("");
$("#state").autocomplete({
source: "states.php",
minLength: 2,
select: function(event, ui) {
$('#state_id').val(ui.item.id);
$('#abbrev').val(ui.item.abbrev);
}
});
$("#state_abbrev").autocomplete({
source: "states_abbrev.php",
minLength: 2
});
});