Can I add an IF statement to a XML query with jQuery?
My query is as follows.
$("#page_all").live('pagebeforecreate', function() {
$.get('http://ontariosheep.org/mobile/data/data_all.php',function(data){
$('.content').empty();
$(data).find('market').each(function(){
var $market = $(this);
html += '<div class="ui-block-a">' + $market.find('lambs').attr('head') + '</div>';
}
}
I'd like to add an if statement on line 6. So that 'html+=' only happens if "$market.find('lambs').attr('head')" is set.
Is this possible, if so how?
EDIT:
All entries do have a head attribute BUT the ones without any head are blank like so head=""
each()function.