https://code.google.com/r/kgraham-flr-map/source/browse/examples/medicare-dynamic-ds.js?spec=svn72fd5de93cf24b0b2baa5d2678d9518741e3d80b&r=72dd5de93cf24b0b2ba4a1c >
有问题的脚本具有$.getJSON('https://storelocator-go-demo.appspot.com/query?callback=?'
来解析数据.
当我尝试打开URL时,出现此错误strconv.ParseFloat: parsing "": invalid syntax
我想看看JSON文件的结构,以便可以用自己的数据替换它.
希望这可以清除我的问题.
解决方案
来自注释:
所以您是说我在尝试打开json文件时遇到的错误是由于服务器问题引起的吗?
好吧,它可以为您提供更有用的错误消息.问题是您没有给它提供所需的参数.
如果我去
https://storelocator-go-demo.appspot.com/query?callback=foo
...然后像你一样,我得到了那个错误.但是,如果我给它参数(这些是从您提供的示例链接中得出的):
https://storelocator-go-demo.appspot.com/query?callback=foo&lat=-29.292219923932738&lng=137.763512&n=-10.691329506145314&e=167.382652625&s=-47.89311034172016&w=108.14437137499999&audio=&access=&_=1364633286163
我获得了有效的JSONP响应.
Referring to my question above, the reason I want to retrieve the file is that I want to know how it is structured so I can make the script that I copied work using my data instead.
Currently, the $.getJSON
url includes the string "callback=?"
in it.
So is there anyway, I can peek through or see how the data is structured in the file thats inside the $.getJSON
url string?
actually, Im following along a demo below
https://code.google.com/r/kgraham-flr-map/source/browse/examples/medicare-dynamic-ds.js?spec=svn72fd5de93cf24b0b2baa5d2678d9518741e3d80b&r=72fd5de93cf24b0b2baa5d2678d9518741e3d80b
Tthe script in question has the $.getJSON('https://storelocator-go-demo.appspot.com/query?callback=?'
to parse the data.
When I tried opening the url, I get this error strconv.ParseFloat: parsing "": invalid syntax
I want to see how the JSON file is structured so I can replace it with my own data instead.
Hope this clears my question.
解决方案
From the comments:
so you mean the error that I got when trying to open the json file is due to a server problem?
Well, it could give you a more useful error message. The problem is that you're not giving it the arguments it requires.
If I go to:
https://storelocator-go-demo.appspot.com/query?callback=foo
...then like you, I get that error. But if I give it arguments (these are cribbed from the examples link you gave):
https://storelocator-go-demo.appspot.com/query?callback=foo&lat=-29.292219923932738&lng=137.763512&n=-10.691329506145314&e=167.382652625&s=-47.89311034172016&w=108.14437137499999&audio=&access=&_=1364633286163
I get back a valid JSONP response.
这篇关于有没有办法可以从服务器检索JSON文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!