Zendフレームワークでajaxでxmlファイルを作成して返却したい
通常、フレームワークなしでそれを行う方法を知っています:
1-> php で xml php ファイルを作成し、次のように table_db を xml ファイルに書き込みます。
=> file name for exemple myfile.php
$xml = new DomDocument("1.0", "utf-8");
$root = $xml->createElement("interventions");
....//write my table from db on my xml file
$xml->FormatOutput=true;
$xml_string = $xml->saveXML();
$xml->save("myfile.xml");
2-> ajax リクエストを作成し、このように myfile.php から xml を読み取ります
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}
else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
data=xmlhttp.responseXML;
alert(data.getElementsByTagName("titre_annonce")[0].firstChild.nodeValue);
// call a function here()
}
}
xmlhttp.open("GET","myfile.php",true);
xmlhttp.send();
しかし、私はzendframe作業でこのすべての手続きを行う方法を知りません
助けてくれてありがとう。