控制器:
/**
* @desc 测试2 获取数据
*/
public function test11()
{
$province = $_POST['province'];
$info = "<city>湖南</city><city>益阳</city>";
$this -> ajaxReturn($info,'xm
l');
}
ajax:
function getCity()
{
xmlHttp = GetxmlHttpobject();
if(xmlHttp)
{
var url = "{$smarty.const.__CONTROLLER__}/test11";
var data = "province="+$('province').value;
xmlHttp.open("post",url,true);
xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
{
alert(xmlHttp.responsexml.getElementsByTagName("city").length);
}
};
xmlHttp.send(data);
}
}
onchange(getCity())事件的时候,弹出的长度总是0,试了几种方法都不行,不知道为什么,求大神指点指点。。。。