I'm trying to retrieve data from ECB RSS feed to get exchange rate values. These values will replace manual exchange rate declarations in a local database.
I'm simply trying to get the value and place it in a variable:
var rssGBP = $.ajax({
type: "GET",
url: "http://ift.tt/1AHGWKG",
dataType: "xml",
success: function(xml) {
$(xml).find('cb:exchangeRate').each(function(){
var pound = $(this).find('cb:value').text();
return pound;
});
}
})
using an alert to check I have the result, it will be removed once I get it working.
alert(rssGBP); returns "[object, Object]" alert(rssGBP.text()); returns "uncaught errortype: object # has no method text"
probably some simple solution I just can't find. I've used similar code before with no problems. Would removing return and having rssGBP.pound.text() work?
Thanks.
No comments:
Post a Comment