I want to retrieve value from database based on dropdown value using the ajax.
Here I'm attaching the screenshot thats what exactly I need. Once we change the year the result should be changed.

我想使用ajax根据下拉值从数据库中检索值。这里我附上截图,这正是我需要的。一旦我们改变了年份,结果就会改变。

So please help me to do this task. Thanks in Advance :)

所以请帮我完成这个任务。提前谢谢:)

3 个解决方案

#1


1

<script type="text/javascript">
jQuery(document).ready(function(){
  $("#district").change(function() {
    var vdcID = {"district_id" : $('#district').val()};
      $.ajax({
      type: "POST",
      data: vdcID,
      url: "<?php echo base_url(); ?>admin/ajax/showVdcById",
      dataType: 'json',
    success: function(data){
      $('#vdc').html("<option>Please Select VDC</option>  ");
        $.each(data, function(i, data){
             $('#vdc').append("<option value='"+i+"'>"+data+"</option>");
        });
       }
     });
   });
 });

this code might help you. it takes value from from a dropdown and updates value on another dropdown based on the id it sends to database

这段代码可能会对您有所帮助。它从下拉菜单中获取值,并根据发送到数据库的id更新另一个下拉菜单的值

更多相关文章

  1. 【Python截图】截图处理
  2. monkeyrunner截图限时免费阅读#1

随机推荐

  1. android二维码入库软件
  2. Android获取剪贴板内容
  3. Android 获取本机号码
  4. Android 开发10个常用工具类
  5. android —— 自定义控件 竖向的ViewPage
  6. android-疑问2
  7. Android 解决AIDL bindService异常
  8. Android 节点进度条
  9. 谈谈Android Activity的生命周期管理
  10. This Android SDK requires Android Deve