18040

Get http://imgur.com/gallery/hot/page/1.json with jQuery

Question:

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 <a href="http://imgur.com/gallery/hot/page/1.json" rel="nofollow">http://imgur.com/gallery/hot/page/1.json</a>. 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 <a href="https://github.com/jamespadolsey/jQuery-Plugins/tree/master/cross-domain-ajax/" rel="nofollow">jquery.xdomainajax.js</a>

Answer1:

Here is my solution, maybe someone it will be usefull.

<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>

Recommend

  • php sockets read json array from java server
  • How can I verify if a coordinate is in a list
  • Type Level Programming in Scala
  • Android listview array adapter selected
  • Can I create dynamic pivot query from key value table with different data types?
  • How do I get a single json value using Webmatrix / razor?
  • Ajax call always returning error 500 client side
  • AJAX Chat Box Scrolling Up Issue
  • Writing Unittest for generic classes… best approach?
  • Amazon S3 - 405 Method Not allowed using POST (Although I allowed POST on the bucket)
  • Pass a custom comparator through a function
  • What is the best data type to store boolean values in a database
  • Populate ArrayList from Stored Procedure result set
  • GoogleApiClient not connecting while using google fit
  • Is it possible to generate a unique numeric value for each row in an iSeries table without looping?
  • NodeJS - Disable JSONP on specific routes
  • Jquery ajax request not able to return data to other function
  • Accessing Windows Azure Queues from client side javascript/jquery
  • formediting modals shows at wrong position
  • Converting datatype Char to Nvarchar
  • JSON - slashes not escaping
  • What is corresponding c++ data type to SQL numeric(18,0) data type?
  • Google Maps api v3 get start and end coordinates of a street
  • How to get latest version of a artifact on Bintray using JSONP
  • C# program and C++ DLL compiled for 32-bit system crash on 64-bit system
  • pyodbc doesn't report sql server error
  • nonblocking BIO_do_connect blocked when there is no internet connected
  • How to revert to previous XCode version?
  • Loading .coffee files via a view in Rails
  • Create DicomImage from scratch using Dcmtk
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Get data from AJAX - How to
  • Bug in WPF DataGrid
  • Where to put my custom functions in Wordpress?
  • Numpy divide by zero. Why?
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • log4net write single file for each call to log.info
  • Getting error when using KSoap library to consume .NET web services
  • git trying to push non-existent file … after clearing cache
  • How to load view controller without button in storyboard?