KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a javascript function which checks to see if an artist exists in an XML file: function artistExists(artist) { // get data from artists.xml $('.loading').show(); $.get(artists_xml, function(xml){ $('.loading').hide(); $(xml).find('artist').each(function(){ if ($(this).find("ar_artist").text() == artist.val()) { alert ('artist exists'); return true; } //end if }); // end each alert ('artist does not exist'); return false; }); // end .get function } // end of artistExists function Am I right in thinking that the 'return true' line should quit execution of the function? I thought it would, but after finding a record and running the first alert execution continues to the failure alert at the bottom. What am I doing wrong please? Thank you.
Tags (comma-separated)
Save Edits
Cancel