GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Tip for javascript people: parsing xml/rss feeds without php (https://gfy.com/showthread.php?t=1121682)

fris 09-20-2013 10:29 AM

Tip for javascript people: parsing xml/rss feeds without php
 
I been wanting to parse feeds on a static only site, but usally you have to use a php file to do it, I just realized Google has a feed parsing api, which turns a xml/rss feed into a json object.

Thought I would pass it along.

You basically take

https://ajax.googleapis.com/ajax/ser...main.com/feed/

it turns the feed into a json object.

I put up a jsfiddle demo which grabs the google trends.

Code:

$(function() {
    $.getJSON('https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://www.google.com/trends/hottrends/atom/feed?pn=p1&num=-1&callback=?&alt=json-in-script', function(data) {
        $.each(data.responseData.feed.entries, function(i, item) {
            var title = item['title'];
            $('#trends').append(title + '<br/>');
        });
    });
});

http://jsfiddle.net/7YDLP/

Hope someone can use this ;)

livexxx 09-20-2013 12:57 PM

I tend to use the google playground to see what things look like quickly

http://code.google.com/apis/ajax/pla...eeds#load_feed

freecartoonporn 09-21-2013 01:04 AM

thanks, will use it .

SDSimon 09-21-2013 04:12 PM

Thank you fris. I will also be using this.

>>>Winners WIN because they NEVER GIVE UP!<<<

SeanLEE 09-22-2013 09:24 AM

Wow.,,, The Grinch is being giving.


All times are GMT -7. The time now is 08:37 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123