PHP AJAX 返回XML資料

2022-03-09 19:13:59 字數 646 閱讀 8379

例子:利用ajax間接訪問資料庫,查出nation表中的資料,返回xml資料,並將nation表中的資料顯示在下拉列表框中

外層建乙個下拉列表框

1<

select

id="sel"

>

2select

>

jqurey**

$(document).ready(function(e) 

//將**加入到下拉列表中的

$("#sel").html(str);

}});

});

處理頁面

1

include("../dbda.class.php");

2$db = new

dbda();

3$sql = "select * from nation";

4$attr = $db->query($sql);5

echo "";

6foreach($attr

as$k=>$v)7

>";

9echo "";

10echo "";

11echo "$k}>";12}

1314

echo "";

PHP AJAX無重新整理返回天氣預報

用php來寫乙個天氣預報的模組 1.2.3.url中的數字 101010100 是城市 所以可以先列出每個城市的城市 然後php程式接收到了城市 再去組裝url,在通過url來顯示該城市的實時天氣。index.php header content type text html charset utf...

Django讀取XML並返回XML

用django對ncclient的介面進行封裝,需要post的資料為xml格式,讀取後傳給ncclient介面的格式仍然是讀取的xml並返回xml格式的響應 我用的xml文字,如 xmlns urn ietf params xml ns netconf base 1.0 xmlns xc urn i...

使用XML方式與JSON方式返回資料

public class videoservice 解析伺服器返回的協議,得到資訊 param instream return throws exception private static listpar ml inputstream instream throws exception if vi...