透過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。
https://prestigeagency.org/ – канабис
reputable mexican pharmacies online: buying from online mexican pharmacy – best online pharmacies in mexico
reputable mexican pharmacies online: mexican rx online – pharmacies in mexico that ship to usa
https://drugs24.pro/# best ed pill
mail order pharmacy india
medication from mexico pharmacy buying prescription drugs in mexico online best online pharmacies in mexico
https://prestigeagency.org/ – вакансии хостес
https://prestigeagency.org/ – работа хостес
male enhancement http://mexicanpharm24.pro/# buying prescription drugs in mexico online
the best ed pills http://indianpharmdelivery.com/# india pharmacy
На платформе 1win доступны ставки на более чем 30 видов спорта, включая футбол, баскетбол, теннис и киберспорт.
Отличный сайт! Всем рекомендую!юридические услуги
I have discovered that intelligent real estate agents everywhere you go are starting to warm up to FSBO ***********. They are recognizing that it’s not only placing a sign in the front area. It’s really about building human relationships with these suppliers who later will become purchasers. So, whenever you give your time and energy to helping these suppliers go it alone — the “Law of Reciprocity” kicks in. Thanks for your blog post.
Feel free to visit my site – Explore Daycares Locations
600 mg neurontin tablets buy gabapentin neurontin 202
amoxicillin online no prescription: buy amoxil – buy amoxicillin online with paypal
We had a 5 day hunt this weekend, and seems like we must always have been able to find more gold, however we’re not complaining.
Activation of both the fire detectors alone, or sprinklers alone, without the concurrent operation of the opposite will not enable water to enter the piping.
If you’re hoping to ultimately add rooms or rework other areas of the house, watch out not to place structural elements or plumbing in places that can obstruct future endeavors.
buy amoxicillin online with paypal: amoxicillin cheapest price – amoxicillin price without insurance
Tree of Life” – The brand new Touristic Brand of the Republic of Moldova!”.
Now we have dependable, repeatable and complementary sources of capital from individual buyers, high-net worth buyers and institutions.
Профессиональный сервисный центр срочный ремонт сотовых телефонов стоимость ремонта телефона
Профессиональный сервисный центр по ремонту сотовых телефонов в Москве.
Мы предлагаем: ближайший ремонт смартфонов
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Add a cozy seating space subsequent to your fireplace, a textured throw and someplace to retailer books and you’ve got an ideal setting for guide lovers.
The resultant ‘pasty’ texture and mechanical fluidity allows the joint to be wiped to shape.
bs2best
The civilizations of Harappa and Mohen-Jo-Daro mostly dealt in wooden crafts manufactured from premium quality, as kings from completely different continents visited India only for Indian Handicrafts.
I?m not sure where you’re getting your info, but good topic. I needs to spend some time learning more or understanding more. Thanks for fantastic information I was looking for this information for my mission.
rybelsus price Rybelsus 7mg Buy compounded semaglutide online
Сервисный центр предлагает ремонт ноутбука samsung ремонт ноутбуков samsung рядом