Skip to content Skip to sidebar Skip to footer

How Can I Get The Value From Json Url

I am using AngularJS and I want to get the value of the price dynamically I mean to get it from a url json data. Is this possible ! This is the url json : url And this is my contro

Solution 1:

I was trying to retrieve the information using angular services, what I'm getting in chrome's console is next:

XMLHttpRequestcannotloadhttp://total.smarteez.eu/submit/?station=101507. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://<<MYIPADDRESS>>' is therefore not allowed access. The response had HTTP status code 401.

Which means that smarteez server dowesn't allows CORS, I mean, it doesn't allow external connections to retrieve data...

You should enable CORS in the smarteez server....but you've mention it's not yours

What I'll do if i were you, it's to load the content inside a PHP variable with file_get_contents() function and then transform it to JSON to finally return it to my angular controller

Post a Comment for "How Can I Get The Value From Json Url"