透過JS跨網域存取XML檔
為了一些安全性的因素,通常伺服器會阻擋跨網域的XML存取,當然如果你是該網站開發者,所開發的頁面應該將會被放在被認可的網域中,不會碰到這個問題,但我們在開發前期有可能會不在所屬的網域,這樣就會造成開發上的困難,不過我們可以透過Yahoo所提供的YQL查詢語法來解決這個問題,以下就是相關的說明:
若我們在自己的電腦用以下的語法去存取一個網路上的XML
<script> $(function () { var xmlSource = "http://stanley.cloudlab.tw/crossDomainXML/testXML.xml"; $.ajax({ url: xmlSource, success: function (data) { console.log(data); } }) }) </script>
很可能會出現「No Access Control Allow Origin」的訊息:
但如果套用上YQL之後
<script> $(function(){ var xmlSource = "http://stanley.cloudlab.tw/crossDomainXML/testXML.xml"; var yqlURL = [ "http://query.yahooapis.com/v1/public/yql", "?q=" + encodeURIComponent("select * from xml where url='" + xmlSource + "'"), "&format=xml&callback=?" ].join(""); $.getJSON(yqlURL, function(data){ console.log(data) }); }) </script>
可以看到已經可以抓到XML內容,這樣可以讓我們較為方便的去開發,其他詳細的使用說明可以參考Yahoo YQL Guide。
eukroma buy online – buy duphaston 10 mg order duphaston pills
O lugar perfeito para jogar jogos de cassino Blaze
Hello there! Do you know if they make any plugins to assist with
Search Engine Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good success.
If you know of any please share. Many thanks!
You can read similar blog here: Escape rooms review
buy bactrim 960mg generic – keppra 1000mg over the counter order tobra 10mg online
Seu cassino online favorito Blaze
Eu recomendo o cassino mais popular Blaze
What’s up, its pleasant article regarding media print, we all understand media is a impressive source of data.
cialis 5mg ohne rezept kaufen
Jogue com prazer neste cassino Blaze
http://sun-shop.com.ua
I will right away grasp your rss feed as I can not find your e-mail subscription hyperlink or newsletter service. Do you’ve any? Kindly allow me know so that I may just subscribe. Thanks.
I really love the way you discuss this kind of topic.*.`-.
I visited a lot of website but I believe this one contains something extra in it in it
Nice post. I find out something more difficult on diverse blogs everyday. Most commonly it is stimulating to see content using their company writers and use something from their store. I’d would rather use some while using content in this little weblog no matter whether you don’t mind. Natually I’ll provide you with a link on the web blog. Thank you sharing.
Generally I do not read article on blogs, however I wish to say that this write-up very forced me to check out and do so! Your writing taste has been amazed me. Thanks, very great post.
купить аттестат за 9 класс http://6landik-diploms.com
both LG and LiteOn makes a great performing dvd burner, they also feature those anti-shock mount,,
Hi there! This is kind of off topic but I need some help from an established blog. Is it very difficult to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about creating my own but I’m not sure where to begin. Do you have any tips or suggestions? Cheers
Experimente o cassino mais popular Blaze
1 комнатная квартира в новостройке купить квартиру от застройщика с отделкой
купить диплом колледжа http://www.6landik-diploms.com/
Experimente o cassino mais popular Blaze
geinoutime.com
홍지황제는 고개를 끄덕이며 감사하다는 듯이 쑤징을 바라보았다.
I absolutely love your blog and find a lot of your post’s to be what precisely I’m looking for. can you offer guest writers to write content for you personally? I wouldn’t mind creating a post or elaborating on many of the subjects you write about here. Again, awesome web log!
we-are-family.ru/contact.htmВ
http://www.arclightcreative.dev/В
krutovo.ru/index.php?name=Account&op=info&uname=ymonozavВ
demo.4admins.ru/viewtopic.php?f=10&t=1549&start=0&view=printВ
account.spb.ru/news/business/3546В
купить квартиру в екатеринбурге в новостройке 1 комнатная квартира в новостройке
Melhor cassino para jogos Blaze
брезаола купить парма купить
Melhores jogos neste cassino Blaze
Все самое интересное из мира игр https://unionbattle.ru обзоры, статьи и ответы на вопросы
прошутто нарезка https://messir-zakaz.ru
Jogue no cassino aprovado Blaze