Zoho Creator APIを使用して、新しいHTMLドキュメント内でアクセスでき、XMLファイルから特定の値が挿入されたレコードを含むXMLファイルを取得しようとしています。jsfiddlehttp : //jsfiddle.net/vm5m6/のコードを参照してください
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","https://creator.zoho.com/api/xml/uownrealestate/view/Agent_Roster_View? authtoken=***scope=creatorapi",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
document.write("<table border='1'>");
var x=xmlDoc.getElementsByTagName("record");
for (i=0;i<x.length;i++)
{
document.write("<tr><td>");
document.write(x[i].getElementsByTagName("value")[0].childNodes[0].nodeValue);
document.write("</td><td>");
}
document.write("</table>");
また、これを行うためにGoogleFusionTablesを使用することも検討していました。簡単に整理された外部データベースから非常に単純なデータを取得するための提案があれば、私に知らせてください。
私もこれを試しましたが、xmlが別のドメインにある場合は機能しないことをどこかで読んでください
$(function() {
var xml = 'https://creator.zoho.com/api/xml/uownrealestate/view/Agent_Roster_View?authtoken==creatorapi'
$(xml).find("record").each(function() {
var stateName = $(this).find("Agent_Name").text();
alert("State: " + stateName );
})});