开发者

jsFiddle Ajax /echo/json not working with plain vanilla JavaScript

I'm trying to use just plain JavaScript within jsFiddle to run a JSON Ajax test...

http://jsfiddle.net/qwYu9/

...but all 开发者_开发百科I get back is an empty object '{}'?

You can see an alternative version by adding /1/ to the end of the above URL - and from that example it breaks completely.

I've looked at the API documentation http://doc.jsfiddle.net/use/echo.html and it's not that helpful (to me anyway).

Can anyone shed any light on this please.

Regards, Mark


data should be in URL format

/echo/json/?json={"text":"some text","array":[1,2,"three"],"object":{"par1":"another text","par2":[3,2,"one"],"par3":{}}}&delay=3

http://jsfiddle.net/zalun/qwYu9/7/


You are trying to query a domain different from the one the javascript is running in. That's not possible since it might pose a security risk and is blocked at the browser level.

This error was generated:

Unsafe JavaScript attempt to access frame with URL http://jsfiddle.net/qwYu9/ from frame with URL http://fiddle.jshell.net/qwYu9/show/. Domains, protocols and ports must match.
XHR finished loading: "http://fiddle.jshell.net/echo/json/".

As you can see, domains differ from jshell.net and jsfiddle.net

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜