Loading data
1.xssj.php
<script src= "Jquery-3.2.0.min.js" ></script><title> Untitled document </title>$ (document). Ready (function(e) {//Async Ajax: While executing the Chuli page, continue executing the code below. High efficiency, no waiting, continue to execute the following code//asynchronous and Synchronous synchronization: Not high efficiency, cannot do two things at the same time$.Ajax ({//async:false,//turn asynchronous off, equivalent to opening synchronizationURL: "xschuli.php",DataType: "TEXT",//complete:function () {},//executes this method before executing//beforesend:function () {},//Send processing request, complete and beforesend can be implemented Progress bar//error:function () {},//If there is an error executing this methodSuccessfunction(data) {//success:function () {} is executed before execution completes varHang = data.Split("|"); varstr = ""; for(vari=0;i) { varLie = Hang[i].Split("^"); STR= str+ "<option value= '" +lie[0]+ ">" +lie[1]+ "</option>"; } $("#sel").html (str); //Alert ($ ("#sel"). Val ()); } }); //Alert ($ ("#sel"). Val ()); $("#qu"). Click (function() {alert ($ ("#sel").Val ()); })});</script>2.xschuli.php
<? PHP require "DBDA.class.php"; $db New Dbda (); $sql = "SELECT * from Nation";
// $arr = $db->query ($sql, 1);//var_dump ($arr);" n001^ Han |n002^ zhuang |n003^ uygur "; Echo $db->strquery ($sql); /* $str = ""; foreach ($arr as $v) { $str = $str. Implode ("^", $v). "|";} $str = substr ($str, 0,strlen ($STR)-1); Echo $str; */
Ajax (Load data)