English 中文(简体)
Get http://imgur.com/gallery/hot/page/1.json with jQuery.
原标题:Get http://imgur.com/gallery/hot/page/1.json with jQuery

Hello i try get this json with $.getJSON, also $.ajax(...) but nothing...

 jQuery.ajax({
                url: "http://imgur.com/gallery/hot/page/1.json",
                type:  GET ,                   
                crossDomain:true,
                success: succ
            });

always i have errors like XMLHttpRequest cannot load http://imgur.com/gallery/hot/page/1.json. Origin my_ip is not allowed by Access-Control-Allow-Origin.

also i tried get jsonp request but also nothing..

   jQuery.ajax({
                url: "http://imgur.com/gallery/hot/page/1.json",
                type:  GET ,
                dataType:  jsonp ,
                crossDomain:true,
                success: succ
            });

have enother error Uncaught SyntaxError: Unexpected token :

its looks like it is possible get this json with this plugin jquery.xdomainajax.js

最佳回答

这里是我的解决方案,也许有人会这样做。

<script src="jquery.xdomainajax.js"></script>
<script>
   $(document).ready(function() {
            jQuery.ajax({
                url: "http://imgur.com/gallery/hot/page/1.json",
                type:  GET ,                 
                success: function(data){
                           //creating json object
                           var jsonResp=$.parseJSON($(data.responseText).text().trim());
                         }

            });   
  });
</script>
问题回答

暂无回答




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签