Using jQuery to Display XML Feeds

Stephen Yagielowicz

Attractively displaying data feeds on a website is a great use for jQuery, with several techniques available for doing so, both hard coded and via plugins — the choice of which depends upon your specific needs. Here are a couple examples for inspiration:

According to its publisher, jParse (jparse.kylerush.net) is a jQuery plugin that allows users to parse XML fetched via the .ajax method, making it fully customizable, easy to use and lightweight at only 4KB. The plugin’s website notes that jQuery .ajax calls are not permitted across domain names, so the XML file to be parsed must be on the same domain as the plugin.

If you want to make short work out of a huge pile of data, jParse may be the solution.

If you want to make short work out of a huge pile of data, jParse may be the solution.

But what if the feeds you want to display are not from the same domain that you wish to show them on?

Gabriele Romanato offers an intriguing RSS feed rotator using jQuery at OnWeb-Dev (onwebdev.blogspot.com /2011/04/jquery-rss-feedrotator.html). This approach utilizes a server-side PHP script to call the desired feeds, displayed via jQuery’s AJAX methods, then using a JavaScript timer to specify the intervals between the feeds being displayed.

Because the feed fetching process can be relatively time-consuming, CSS is used to hide certain elements during retrieval — revealing them individually after a preset delay.

This is an interesting method that offers a lot of flexibility in execution and which could prove useful, for example, to adult affiliates seeking to customize and aggregate a sponsor’s marketing feeds.

A bit of searching will turn up a variety of other examples of cross-domain scripting, including sample PHP proxies that fetch RSS feeds from multiple servers.

Related:  

More Articles

opinion

Privacy Notices Shouldn’t Be Treated as an Afterthought

Corey D. Silverstein ·
opinion

Legal Issues Pop Up When Filming Sex in Public

Lawrence G. Walters ·
trends

A Road Less Traveled: Accepting Alternative Payment Solutions

Stephen Yagielowicz ·
trends

Credit Card Processing Today: Decline or Dominance?

Stephen Yagielowicz ·
trends

Shifting Regulations: Keeping on the Straight and Narrow

Stephen Yagielowicz ·
trends

Putting Your Best Foot Forward: Billing's Best Practices

Stephen Yagielowicz ·
profile

PornDoe Premium — 35 Network Sites and Counting

Rhett Pardon ·
profile

Q&A: White Label Dating’s Steve Pammenter Expands Horizons

Alejandro Freixes ·
opinion

Facebook Ends Custom Link Preview Snippets

Lauren MacEwen ·
Show More