I am trying to use Jquery to load the contents of an XML file and then format (html) the results. The only thing is that, I would like it to load only nodes in the XML file that contain a specific phrase. I have been unable to find instructions on this.
This phrase will be a variable so, I will have a master XML file with all values and different pages on the site will have different variables, thereby loading different items from the XML, on different pages.
Looking to use something similar to this method: http://think2loud.com/reading-xml-with-jquery/
It load the XML but, I cant get it look for specific text.
$(document).ready(function(){
$.ajax({
type: "GET",
url: "sites.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('site').each(function(){
var id = $(this).attr('id');
var title = $(this).find('title').text();
var url = $(this).find('url').text();
$('<div class="items" id="link_'+id+'"></div>').html('<a href="'+url+'">'+title+'</a>').appendTo('#page-wrap');
$(this).find('desc').each(function(){
var brief = $(this).find('brief').text();
var long = $(this).find('long').text();
$('<div class="brief"></div>').html(brief).appendTo('#link_'+id);
$('<div class="long"></div>').html(long).appendTo('#link_'+id);
});
});
}
});
});