开发者

can I use a file instead of server side "apache http server + PHP + MySQL"

Hey, friend. as show in title: My aim is "use ajax to connect with client side written with asp.net and server side written with whatever", can I use a file instead of server side "apache http server + PHP + MySQL"? Instead of server side tech composite, the Demo still need to show ajax's asynchronous power, Is the de开发者_高级运维sign workable? thanks first:)


Unless I'm mis-understanding your question, yes, you can use a static file instead of a dynamically generated PHP/MySQL scenario...for instance, pulling in an XML file:

<script type="text/javascript">
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
{
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    x=xmlhttp.responseXML.documentElement.getElementsByTagName("SOMETAGNAME");
        //do something with it
    }
}
xmlhttp.open("GET","staticfile.xml",true);
xmlhttp.send();

</script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜