Solved:
function get_idc_fields(jqxml, field_names) { var ret = new Object(); jqxml.find('*').each(function(Index) { //I could add an 'if($( this )[ 0 ].nodeName == 'idc:field') somewhere in here, //but it isn't necessary var target = $(this)[0]; if(target.hasAttribute("name")) { var tmp = target.getAttribute("name"); if($.inArray(tmp, field_names)) { ret[tmp] = target.textContent; } } }); return ret; } function on_success(data) { if(!out.innerHTML || typeof(out.innerHTML) != "string") { out.innerHTML = ""; } var jqxml = $( data ); //0 on success, else failure var fields = get_idc_fields(jqxml, ['StatusCode','StatusReason','StatusMessage']); out.innerHTML += "<HR><SPAN CLASS=\"statusnote\">Response Text(" + data + "):</SPAN><BR>"; out.innerHTML += "<TABLE><TR><TD>" + fields.StatusCode + ")</ TD><TD>" + fields.StatusReason + ")</ TD><TD>" + fields.StatusMessage + ")</ TD></TR></TABLE>"; }