jQuery autocomplete:如何在结果中选择某些内容后调用getJson?
16lz
2021-01-22
I have a form and the "Name" input text is using jQuery autocomplete. What I needed was when I select a name in the list result of autocomplete, I fill the other input texts (date of birth, telephone etc) based upon the name selected.
我有一个表单,“名称”输入文本使用jQuery自动完成。我需要的是当我在自动填充的列表结果中选择一个名称时,我根据所选的名称填写其他输入文本(出生日期,电话等)。
Does anyone know how to make this second ajax call after a name is chosen?
有人知道在选择名字后如何进行第二次ajax调用吗?
thanks!!
2 个解决方案
#1
Assuming the select ID from where the names are is "thenames", you can do something like:
假设名称所在的选择ID是“thenames”,您可以执行以下操作:
$("#thenames").change(function (){
var params = {
"id": $(this).val()
};
$.getJSON("person_details.php", params, function (jsonData){
// Fill the rest of input texts.
});
});
更多相关文章
- 解析PHP的基本文本输出
- 使用jquery animate()实现对文本的反弹效果?
- Jquery禁用/启用按钮与文本框代码
- 获取复选框的文本属性
- 使用数字作为javascript对象元素的名称
- 从内部获取函数名称
- jQuery中的bind绑定事件与文本框改变事件的临时解决方法
- 克隆文本并插入壁橱标题范围
- 如何删除/更改JQuery UI自动完成帮助文本?