How can I get the value from json url

后端 未结 1 568
無奈伤痛
無奈伤痛 2021-01-25 01:26

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

相关标签:
1条回答
  • 2021-01-25 02:02

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

    XMLHttpRequest cannot load http://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

    0 讨论(0)
提交回复
热议问题