简体   繁体   English

不能使用$ .getJSON

[英]can't use $.getJSON

I am trying to get an answer from my server. 我正在尝试从服务器获取答案。 Merely get the var json.src = "http://image/path/file.jpg" from the server but I can't even get into the getJSON function whatsoever. var json.src = "http://image/path/file.jpg"服务器获取var json.src = "http://image/path/file.jpg" ,但是我什至无法进入getJSON函数。

JSFiddle JSFiddle

I must be neglecting something, but I can't use $.getJSON , nor $.get Would appreciate any help Thanks 我必须忽略一些东西,但是我不能使用$.getJSON$.get会有所帮助的,谢谢

This wont work if you're trying to load content from a different server to that on which the request is being made. 如果您尝试将内容从另一台服务器加载到发出请求的服务器上,则此方法将无效。 This is due to Same Origin Policy . 这是由于相同来源策略

Also, what's with the image url in your question? 另外,您的问题中的图片url是什么? That's not JSON. 那不是JSON。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM