Hi there,
I recently created an xml feed -> html javascript function for an iPhone app I'm developing in jQTouch. Original Tutorial & Code: http://bit.ly/cnNMKu
I was wondering if someone would know a quick and easy way to refresh the xml data (grab the feed again) when a link is clicked.
eg. in the code:
<div id="btns">
<ul>
<li><a href="#feed">Go to feed</a></li> <!-- When i click this, I want the getDataFeed function to dump the data & rerun. -->
</div>
<div id="feed">
<div id="content_from_feed_inserted_here"></div>
</div>
in the javascript:
$(document).ready(function() {
function getDataFeed() {
$('.loadingPic').show(); // show progress bar
$.get('http://xxxxxxx.com/information.xml', function(d) {
$(d).find('location').each(function(){
var $location = $(this);
var the_data = $location.find('xml_data').text();
var collected_data = collected_data += '<span>' + the_data + '</span>' ;
$('#content_from_feed_inserted_here').empty().append($(collected_data)); // empty div first
$('.loadingPic').fadeOut(1400); // remove progress bar
});
}
// run on page load
getDataFeed();
// how do i also get it running when i click <li><a href="#feed">Go to feed</a></li>
});
Many thanks in advance for your help!