In general, can you get an XML file from an API using JavaScript?
-
I understand that most api's would prevent you from accessing them with javascript because of security problems, but are there ways around that? EDIT: I'm sorry, this question is particularly about one API, the http://legiscan.com/legiscan api, which seems to be adverse to access using javascript, jquery, etc.
-
Answer:
If they don't have any technique for accessing the data in a cross-domain way, like CORS (Cross Origin Resource Sharing) or JSONP, then the best way to handle this is to just create your own proxy on your own domain to access the API. Just have a small server that just forwards your JavaScript's Ajax requests over to the API, and returns the response that it provides.
Clarence Leung at Quora Visit the source
Other answers
Sure. JQuery is particularly adept at this. You can specify the type of data the jQuery GET call receives from the server.
Marc Gottlieb
Related Q & A:
- how delete node in xml file using php?Best solution by Stack Overflow
- how to parse a xml file using jquery and phonegap?Best solution by Stack Overflow
- In Visual Studio 2012 or 2013, how can I register a DLL file on Windows 7 64-bit computer using a Custom Action command?Best solution by Stack Overflow
- How to get current YouTube video url using JavaScript?Best solution by Stack Overflow
- What jobs can you get with an associate degree in general studies?Best solution by learn.org
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.