使用JavaScript获取数据 [英] getting data using javascript

查看:106
本文介绍了使用JavaScript获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能使用HTM和JavaScript得到这个汇率从Web服务?


  

字典Türkiye的土耳其= | DUNYA =世界|儿子güncellenme=最后更新日期



解决方案

欧洲银行提供了对欧元交易中最常见的货币免费的每日汇率的URL。格式为XML。

http://www.ecb.europa.eu/stats/ eurofxref / eurofxref-daily.xml

您必须让你的服务器上的网页,将调用XML解析之上,并返回值。

有就是在这样页面的一个PHP的例子:
http://www.ecb.int/stats/exchange/eurofxref /html/index.en.html

这个例子的输出是文本,但我想发送 JSON ,而不是会更容易在浏览器的JavaScript来处理。

how can I get this exchange rates from a web service using htm and javascript?

Dictionary Türkiye = Turkey | Dünya = World | Son güncellenme = Last updating date

解决方案

The european bank delivers a free daily exchange rates url for the most common currencies traded against the EURO. The format is XML.

http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml

You have to make a page on your server that will call the xml above parse it and return the values.

There is a PHP example of such page at: http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html
The output of the example is text, but I guess sending a JSON instead would be easier to handle with javascript on the browser.

这篇关于使用JavaScript获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆