-1

i would like to create a dynamic iframe who will show a random URL from a specific Feed i was able to make it once it worked fo a while but stopped working and wasn't able to make it work back anymore.

Here is the code below :

 <script>
function GetContent(feedUrl) {
    var feedApiGetJSON = 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=15&callback=?&q=';
    jQuery.ajax({
        url: feedApiGetJSON + feedUrl,
        dataType: 'jsonp',
        jsonpCallback: 'JsonpCallback'
    });
}

function JsonpCallback(data) {
    if (data.responseStatus == "200") {
        //alert(data.responseData.feed.title);

        var e = Math.floor(Math.random() * data.responseData.feed.entries.length + 1);

        jQuery("#iframe_url").attr("src", data.responseData.feed.entries[e].link);


    }

}

jQuery(document).ready(function () {
    GetContent("http://bit.ly/1SyQdL0");
});

<iframe id="iframe_url" src="" style="border: 0px;height: 800px;width: 600px"></iframe>

JSfiddle link

Thanks For Help

1 Answers1

0
/* callback */JsonpCallback({"responseData": null, "responseDetails": "This API is no longer available.", "responseStatus": 403})

https://developers.google.com/feed/v1/jsondevguide

"This API is officially deprecated. See our deprecation policy in our Terms of Service for details."

Probably your issue.

WHol
  • 2,206
  • 2
  • 13
  • 16
  • So is it google ajax that is not working ? and how can i ceate somthing simillar without google ajax ? – Resurectionx Dec 03 '15 at 11:30
  • You can use an alternative like http://blog.superfeedr.com/google-feed-api-alternative/ There should be enough of a sample there for you get to get started. – WHol Dec 03 '15 at 11:57
  • I tried superfeedr.com when u want to generate the token that u need for your script it ask you for money. Any other FREE solution please! – Resurectionx Dec 03 '15 at 20:11
  • Sorry, I thought it was free. Check out this thread https://stackoverflow.com/questions/34016263/real-alternative-for-google-feed-api – WHol Dec 04 '15 at 10:55