Hi,
basically I am parsing a xml file and retreving certain elements from that xml file using the each function. However I now need to just return the first value, not 'each' value. If anyone could help it would be awesome.
Code so far:
// basic ajax call to retrieve xml file - then on success sent over to checkNotDate function
$('#notifyBox').empty();
$.ajax ({
type: "GET",
url: "anyFeed.xml",
datatype: "xml",
success: checkNoteDate
});
// parse xml and display in alert
function checkNoteDate (xml) {
$(xml).find("entry").each(function()
{
var $item = $(this);
var title = $item.find("title").text();
var link = $item.find("link").attr("href");
var output = "<a href=\"" + link + "\" target=\"_self\">" + title + "<\/a>" + "<br />";
alert(output);
});
}
So all I need to do is just get the first value and save to a var. thanks in advance