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.
  });
});

更多相关文章

  1. 解析PHP的基本文本输出
  2. 使用jquery animate()实现对文本的反弹效果?
  3. Jquery禁用/启用按钮与文本框代码
  4. 获取复选框的文本属性
  5. 使用数字作为javascript对象元素的名称
  6. 从内部获取函数名称
  7. jQuery中的bind绑定事件与文本框改变事件的临时解决方法
  8. 克隆文本并插入壁橱标题范围
  9. 如何删除/更改JQuery UI自动完成帮助文本?

随机推荐

  1. 使用/发送POST数据时的libcurl C问题(不
  2. 在自建域名下调试php
  3. 高效的敏感词过滤方法(PHP)
  4. Symfony:我可以从Type / Form返回null吗?
  5. PHP - 将字符串转换为键值数组
  6. ajax在php页面上获得一个值的结果
  7. php穷举思维探究百钱白鸡问题
  8. PHP用空格分割文本为数组的方法
  9. 定制安全的PHP环境
  10. 【PHP】一个setcookie的bug整死我了