<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="../jquery-1.11.2.min.js"></script>
</head>

<body>


<select id="nation" name="nation">
	
</select>


</body>
<script type="text/javascript">
$(document).ready(function(e) {
    
	$.ajax({
		async:false,
		url:"chuli.php",
		dataType:"TEXT",
		success: function(data){
			var str = "";
			var hang = data.split("|");
			for(var i=0;i<hang.length;i++){
				var lie = hang[i].split("^");
				str = str + "<option value='"+lie[0]+"'>"+lie[1]+"</option>";
			}
			$("#nation").html(str);
		}
	});
	
	alert($("#nation").val());
	
});
</script>
</html>



处理页面

<?php
require_once "../DBDA.class.php";
$db = new DBDA();
$sql = "select * from nation";
echo $db->strQuery($sql);

  

posted on 2017-09-21 09:10  唯懿  阅读(89)  评论(0编辑  收藏  举报