开发者

Json callback problem

开发者 https://www.devze.com 2023-01-12 16:42 出处:网络
I\'m trying to get a greasemonkey\'s script to work jquery and json. this is the json url http://www.sora101.net/auction.php?id=1&callback=

I'm trying to get a greasemonkey's script to work jquery and json. this is the json url http://www.sora101.net/auction.php?id=1&callback=

this is part of the script

$.getJSON("http://sora101.net/aucti开发者_如何学编程on.php?id=1&callback=?",
                    function(data){
                        alert(data.id);
                    }
                    );

i always get something like this "Error: jsonp1282646809490 is not defined" in the console.

i also found this h**p://www.xucia.com/CrossSafe/test.html on this site i get the right object returned but when i include this in my script it doesn't work...

can anyone help me? thanks and sorry for bad english


It seems like you should be using JSONP and now JSON as you're using different domains.

From jQyuery.getJSON() documentation: Blockquote

JSONP If the URL includes the string "callback=?" in the URL, the request is treated as JSONP instead. See the discussion of the jsonp data type in $.ajax() for more details.

0

精彩评论

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