Does anyone know how I would be able to access the “name”, “url”, “headline”, “timestamp”, and “excerpt” from the array “article” using the $.getJSON?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It does not appear that daylife.com provides “jsonp” as a return type. This means that the javascript object in the body of the script tag is going to result in an error in the browser. And because of that you won’t be able to get at the data within that script tag as far as I know.
If they did support jsonp they would look at that callback url and would return something like the following:
Instead of that they return this:
A workaround is to proxy calls through your server to their server. Below is a C# sample of how it might be done. The ProxyHandler method is to just illustrate how ProxyJsonpRequest might be used from some web framework. It doesn’t have a specific one in mind. The idea is that the javascript client will pass a parameter which specifies the remote url to which the server should request data. The server makes that request and returns that data to the client. The code below also only works for GET requests.