dianfu123
<head>
<script src="../jquery-2.2.3.min.js"></script>
</head>

<body>
<select id="sel">
</select>
</body>

<script type="text/javascript">
$(document).ready(function(e) {
    
    $.ajax({
        url:"ChuLi.php",
        dataType:"JSON",
        success: function(data){
            
            var str = "";
            for(var k in data)
            {
                str+="<option value=\'"+data[k][0]+"\'>"+data[k][1]+"</option>";
            }
            
            $("#sel").html(str);
            
            }
        });
    
});
</script>
复制代码

处理页面:

复制代码
<?php

include("../DBDA.php");
$db = new DBDA();

$sql = "select * from Nation";
$attr = $db->Query($sql);

echo json_encode($attr);//JSON独有



?>

分类:

技术点:

相关文章:

  • 2021-12-26
  • 2021-11-27
  • 2021-07-22
  • 2021-11-29
  • 2021-11-17
  • 2021-08-07
  • 2021-11-04
  • 2021-11-27
猜你喜欢
  • 2021-11-20
  • 2021-07-07
  • 2021-12-06
  • 2020-11-14
  • 2021-11-04
  • 2021-11-27
  • 2021-11-20
相关资源
相似解决方案