unable to display xml data and images defined in xml doc

I have a html table that displays sports stats however it's not working I created DUPLICATE ID FOR EVERYTHING like lpYDS and lpYDS2 I wanted to simply this and make it a selector statement.
I need to display home and away stats for QB ,RB, AND WR. So I was going to do it this way like this i GOT A BRACKET PROBLEM I Can't solve.

 if ($(Team).attr('vh') == "H") {

getStats();
}

 if ($(Team).attr('vh') == "A") {

getStats();

}

getStats needs to be looked at  

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Sports Network</title>
<link rel="stylesheet" href="http://powerzsoftware.com/css/jquery-ui-1.8.9.customver1.css">
<style type="text/css">
.IMAGEALIGN {
	text-align: center;
	vertical-align: middle;
}
.imagealign2 {
	text-align: center;
	vertical-align: top;
}

.tophigh {
	text-align: center;
	vertical-align: top;
}
.textcolor {
	color: #FFF;
}
.tbcolor {
	color: #FFF;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
 var xmlPath = '.' //'/xml/cfoot/scores/real';
  var xmlGameID = '40350'; // game id only, _counter.xml will be added in the ajax call
 

  
  var arrIDs = {
    "Rushing_Stats": {
      id: "Rusher",
      start: "Rush",
      attrs: {
      "ATT": "Attempts",
      "YDS": "Yards",
      "AVG": "Average",
      "TD": "Touchdowns"
      }
    },
    "Passing_Stats": {
      id: "Passer",
      start: "Pass",
      attrs: {
        "ATT": "Attempts",
        "COMP": "Completions",
        "YDS": "Yards",
        "TD": "Touchdowns",
        "INT": "Interceptions"
      }
    },
    "Pass_Receiving_Stats": {
      id: "Receiver",
      start: "Receiving",
      attrs: {
        "REC": "Receptions",
        "YDS": "Yards",
        "AVG": "Average",
        "TD": "Touchdowns"
      }
    }
  };

 

function getStats()
{
  $.ajax(
  {
    type: "GET",
    url: xmlPath + "/" + xmlGameID +  ".xml",
    dataType: "xml",
    success: function (data)
    {
      var d = $(data);
      var Play = d.find('Play');
		

    
     d.find('Team').each(function(i, Team){
 var team = $(Team);
          var id = team.attr("ID").toLowerCase();
      if ($(Team).attr('vh') == "H") {
         
// DOESN'T EXIST FOR COLLEGE
       // var Passing = $(CurrentLeaders).find('Passing[TeamID="' + TeamID + '"]');
        //var Rushing = $(CurrentLeaders).find('Rushing[TeamID="' + TeamID + '"]');
        //var Receiving = $(CurrentLeaders).find('Receiving[TeamID="' + TeamID + '"]');

        var PlayerID_Pass = Passing.attr('PlayerID');
        var PlayerID_Rush = Rushing.attr('PlayerID');
        var PlayerID_Recv = Receiving.attr('PlayerID');
 
      
        var teamlogoPlus = ($(Team).attr('ID') == TeamOffID) ? 0 : 3;
        for (var teamlogoCounter = 1; teamlogoCounter <= 3; teamlogoCounter++) {
          $('#teamlogo'+(teamlogoCounter+teamlogoPlus)).attr('src', 'http://sportsnetwork.com/gamecast/Cfootlogos/' + $(Team).attr('ID') + ".png");
        }

        var idFirstOrSecond = ($(Team).attr('ID') == TeamOffID) ? '' : '2'; // postfix for stats id selectors to target fields in first or second table

       

        var Individual_Statistics = d.find('Individual_Statistics[IS_TeamID="' + TeamID + '"]');
        $(Individual_Statistics).children().each(function(i, AllStats){
          if (arrIDs[AllStats.nodeName])
          {
            var idselector = arrIDs[AllStats.nodeName].id;
            var nodeStart = arrIDs[AllStats.nodeName].start; // AllStats.nodeName.substr(0, AllStats.nodeName.length - 5); // need the part before Stats
            var PlayerIDforThisListing = (nodeStart == "Rush" ? PlayerID_Rush : (nodeStart == "Receiving" ? PlayerID_Recv : PlayerID_Pass));
            $(AllStats).find(nodeStart + '_Listing').each(function(i2, Pass_Listing){
              if ($(Pass_Listing).find(nodeStart + '_PlayerID').text() == PlayerIDforThisListing)
              {
                var Firstname = $(Pass_Listing).find(nodeStart + '_Firstname').text();
                var Lastname = $(Pass_Listing).find(nodeStart + '_Lastname').text();
                $('#'+idselector+idFirstOrSecond).html(Firstname + ' ' + Lastname);
                switch (nodeStart)
                {
                  case "Rush":
                    $("#lratt" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["ATT"] ).text() );
                    $("#lryds" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["YDS"] ).text() );
                    $("#lravg" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["AVG"] ).text() );
                    $("#gTDS"  +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["TD"]  ).text() );
                    break;
   
                  case "Pass":
                    $("#lpatt" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["ATT"] ).text() );
                    $("#lpComp"+idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["COMP"]).text() );
                    $("#lpYDS" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["YDS"] ).text() );
                    $("#lpTD"  +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["TD"]  ).text() );
                    $("#LPINT" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["INT"] ).text() );
                    break;
   
                  case "Receiving":
                    $("#lrrec" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["REC"] ).text() );
                    $("#lrryds"+idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["YDS"] ).text() );
                    $("#lrrAVG"+idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["AVG"] ).text() );
                    $("#lrrtd" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["TD"]  ).text() );
                    break;
               }
              }
            }); // each xxx_Listing
          }
        }); // each xxx_Stats
	  }
      }); // each Team
	
     if (d.find('Play').attr("Status").toUpperCase() === "FINAL") {
        clearInterval(myVar);
      }
	 }
    }
});
// }); //ajax
}
</script>

</head>

<body>
<table width="800" height="127" border="1" class="tbcolor">
  <tr>
    <td width="75" rowspan="4" class="tophigh"><p><strong><span class="imagealign2"><img src="http://www.sportsnetwork.com/gamecast/Cfootlogos/491.png" name="teamlogo1" width="50" height="50" id="teamlogo1"></span></strong></p></td>
    <td colspan="4"><div align="center" class="GCPBP"><strong>Leading Rusher</strong></div></td>
    <td width="77" rowspan="4" class="imagealign2"><strong><span class="tophigh"><img src="http://sportsnetwork.com/gamecast/Cfootlogos/491.png" alt="" name="teamlogo2" width="100" height="100" id="teamlogo2"></span></strong></td>
    <td colspan="5"><div align="center" class="GCPBP"><strong>Leading Passer</strong></div></td>
    <td width="83" rowspan="4" class="imagealign2"><strong><span class="tophigh"><img src="http://sportsnetwork.com/gamecast/Cfootlogos/491.png" alt="" name="teamlogo3" width="100" height="100" id="teamlogo3"></span></strong></td>
    <td colspan="4"><div align="center" class="GCPBP"><strong>Leading Receiver</strong></div></td>
  </tr>
  <tr>
    <td height="23" colspan="4" id="Rusher"><div align="center" id="Rusher"><strong id="Rusher">Rusher</strong></div></td>
    <td colspan="5" id="Passer"><div align="center" id="Passer"><strong id="Passer">Passer</strong></div></td>
    <td colspan="4" id="Receiver"><div align="center" id="Receiver"><strong id="Receiver">Receiver</strong></div></td>
  </tr>
  <tr>
    <td width="42" height="26"><div align="center" class="GCPBP"><strong>ATT</strong></div></td>
    <td width="38"><div align="center" class="GCPBP"><strong>YDS</strong></div></td>
    <td width="37"><div align="center" class="GCPBP"><strong>AVG </strong></div></td>
    <td width="32"><div align="center" class="GCPBP"><strong>TD</strong></div></td>
    <td width="39"><div align="center" class="GCPBP"><strong>ATT</strong></div></td>
    <td width="46"><div align="center" class="GCPBP"><strong>COMP</strong></div></td>
    <td width="35"><div align="center" class="GCPBP"><strong>YDS</strong></div></td>
    <td width="38"><div align="center" class="GCPBP"><strong>TD</strong></div></td>
    <td width="42"><div align="center" class="GCPBP"><strong>INT</strong></div></td>
    <td width="37"><div align="center" class="GCPBP"><strong>REC</strong></div></td>
    <td width="40"><div align="center" class="GCPBP"><strong>YDS</strong></div></td>
    <td width="36"><div align="center" class="GCPBP"><strong>AVG</strong></div></td>
    <td width="37"><div align="center" class="GCPBP"><strong>TD</strong></div></td>
  </tr>
  <tr>
    <td height="36"><div align="center" class="imagealign2" id="lratt"><strong id="lratt">lratt</strong></div></td>
    <td><div align="center" class="imagealign2" id="lryds"><strong id="lryds">lryds</strong></div></td>
    <td><div align="center" class="imagealign2" id="lravg"><strong id="lravg">lravg</strong></div></td>
    <td><div align="center" class="imagealign2" id="gTDS"><strong id="gTDS">lgTDS</strong></div></td>
    <td><div align="center" class="imagealign2" id="lpatt"><strong id="lpatt">lpatt</strong></div></td>
    <td><div align="center" class="imagealign2" id="lpComp"><strong id="lpComp">lpComp</strong></div></td>
    <td><div align="center" class="imagealign2" id="lpYDS"><strong id="lpYDS">lpYDS</strong></div></td>
    <td><div align="center" class="imagealign2" id="lpTD"><strong id="lpTD">lpTD</strong></div></td>
    <td><div align="center" class="imagealign2" id="LPINT"><strong id="LPINT">LPINT</strong></div></td>
    <td><div align="center" id="lrrec"><strong id="lrrec">lrrec</strong></div></td>
    <td><div align="center" id="lrryds"><strong id="lryds">lryds</strong></div></td>
    <td><div align="center" id="lrrAVG"><strong id="lrAVG">lrAVG</strong></div></td>
    <td><div align="center" id="lrrtd"><strong id="lrtd">lrtd</strong></div></td>
  </tr>
</table>
<table width="855" height="126" border="1" class="tbcolor">
  <tr>
    <td width="62" rowspan="4" class="tophigh"><strong><span class="textcolor"><img src="http://sportsnetwork.com/gamecast/Cfootlogos/498.png" alt="" name="teamlogo4" width="50" height="50" id="teamlogo4"></span></strong></td>
    <td colspan="4"><div align="center" class="GCPBP"><strong><span class="GCPBP">Leading Rusher</span></strong></div></td>
    <td width="63" rowspan="4" class="imagealign2"><strong><span class="textcolor"><span class="tophigh"><img src="http://sportsnetwork.com/gamecast/Cfootlogos/498.png" alt="" name="teamlogo5" width="50" height="50" id="teamlogo5"></span></span></strong></td>
    <td colspan="5"><div align="center" class="GCPBP"><strong>Leading Passer</strong></div></td>
    <td width="70" rowspan="4" class="imagealign2"><strong><span class="textcolor"><span class="tophigh"><img src="http://sportsnetwork.com/gamecast/Cfootlogos/498.png" alt="" name="teamlogo6" width="57" height="64" id="teamlogo6"></span></span></strong></td>
    <td colspan="4"><div align="center" class="GCPBP"><strong><span class="GCPBP">Leading Receiver</span></strong></div></td>
  </tr>
  <tr>
    <td height="23" colspan="4" id="Rusher2"><div align="center" id="Rusher2"><strong><span class="textcolor" id="Rusher2">Rusher</span></strong></div></td>
    <td colspan="5" id="Passer2"><div align="center" id="Passer2"><strong><span class="textcolor" id="Passer2">Passer</span></strong></div></td>
    <td colspan="4" id="Receiver2"><div align="center" id="Receiver2"><strong><span class="textcolor" id="Receiver2">Receiver</span></strong></div></td>
  </tr>
  <tr>
    <td width="37" height="26"><div align="center" class="GCPBP"><strong>ATT</strong></div></td>
    <td width="39"><div align="center" class="GCPBP"><strong>YDS</strong></div></td>
    <td width="44"><div align="center" class="GCPBP"><strong>AVG </strong></div></td>
    <td width="46"><div align="center" class="GCPBP"><strong>TD</strong></div></td>
    <td width="36"><div align="center" class="GCPBP"><strong>ATT</strong></div></td>
    <td width="54"><div align="center" class="GCPBP"><strong>COMP</strong></div></td>
    <td width="46"><div align="center" class="GCPBP"><strong>YDS</strong></div></td>
    <td width="37"><div align="center" class="GCPBP"><strong>TD</strong></div></td>
    <td width="50"><div align="center" class="GCPBP"><strong>INT</strong></div></td>
    <td width="39"><div align="center" class="GCPBP"><strong>REC</strong></div></td>
    <td width="39"><div align="center" class="GCPBP"><strong>YDS</strong></div></td>
    <td width="47"><div align="center" class="GCPBP"><strong>AVG</strong></div></td>
    <td width="46"><div align="center" class="GCPBP"><strong>TD</strong></div></td>
  </tr>
  <tr>
    <td height="23"><div align="center" class="imagealign2" id="lratt2"><strong><span class="textcolor" id="lratt2">lratt</span></strong></div></td>
    <td><div align="center" class="imagealign2" id="lryds2"><strong><span class="textcolor" id="lryds2">lryds</span></strong></div></td>
    <td><div align="center" class="imagealign2" id="lravg2"><strong><span class="textcolor" id="lravg2">lravg</span></strong></div></td>
    <td><div align="center" class="imagealign2" id="gTDS2"><strong><span class="textcolor" id="gTDS2">lgTDS</span></strong></div></td>
    <td><div align="center" class="imagealign2" id="lpatt2"><strong><span class="textcolor" id="lpatt2">lpatt</span></strong></div></td>
    <td><div align="center" class="imagealign2" id="lpComp2"><strong><span class="textcolor" id="lpComp2">lpComp</span></strong></div></td>
    <td><div align="center" class="imagealign2" id="lpYDS2"><strong><span class="textcolor" id="lpYDS2">lpYDS</span></strong></div></td>
    <td><div align="center" class="imagealign2" id="lpTD2"><strong><span class="textcolor" id="lpTD2">lpTD</span></strong></div></td>
    <td><div align="center" class="imagealign2" id="LPINT2"><strong><span class="textcolor" id="LPINT2">LPINT</span></strong></div></td>
    <td><div align="center" id="lrrec2"><strong><span class="textcolor" id="lrrec2">lrrec</span></strong></div></td>
    <td><div align="center" id="lrryds2"><strong><span class="textcolor" id="lrryds2">lryds</span></strong></div></td>
    <td><div align="center" id="lrrAVG2"><strong><span class="textcolor" id="lrrAVG2">lrAVG</span></strong></div></td>
    <td><div align="center" id="lrrtd2"><strong><span class="textcolor" id="lrrtd2">lrtd</span></strong></div></td>
  </tr>
</table>
<p>&nbsp; </p>
<p>&nbsp; </p>
<script>
var myVar=setInterval(function(){myTimer()},1000);

function myTimer()
{

getStats();

}
  </script>
</body>
</html>

Open in new window

40350.XML
LeadersCollegeTest.html
powerztomAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Robert SchuttConnect With a Mentor Software EngineerCommented:
There seem to be a number of discrepancies between the file and the posted code. There were indeed 1 or 2 closing braces too many...

Also I saw white text on white background? then nothing seems to show up of course.

When you delete those 3 lines, some other lines become unnecessary and will error out.

I added a .first() which makes the each() a bit senseless but it's a quick fix ;-)

try this:
function getStats()
{
  $.ajax(
  {
    type: "GET",
    url: xmlPath + "/" + xmlGameID +  ".xml",
    dataType: "xml",
    success: function (data)
    {
      var d = $(data);
      var Play = d.find('Play');

      var TeamOffID = $(Play).attr('OffID');
      var TeamDefID = $(Play).attr('DefID');

      d.find('Team').each(function(i, Team){
        var team = $(Team);
        var id = team.attr("ID").toLowerCase();
        //if ($(Team).attr('vh') == "H") {
           
          // DOESN'T EXIST FOR COLLEGE
          //var Passing = $(CurrentLeaders).find('Passing[TeamID="' + TeamID + '"]');
          //var Rushing = $(CurrentLeaders).find('Rushing[TeamID="' + TeamID + '"]');
          //var Receiving = $(CurrentLeaders).find('Receiving[TeamID="' + TeamID + '"]');

          //var PlayerID_Pass = Passing.attr('PlayerID');
          //var PlayerID_Rush = Rushing.attr('PlayerID');
          //var PlayerID_Recv = Receiving.attr('PlayerID');

          var teamlogoPlus = ($(Team).attr('ID') == TeamOffID) ? 0 : 3;
          for (var teamlogoCounter = 1; teamlogoCounter <= 3; teamlogoCounter++) {
            $('#teamlogo'+(teamlogoCounter+teamlogoPlus)).attr('src', 'http://sportsnetwork.com/gamecast/Cfootlogos/' + $(Team).attr('ID') + ".png");
          }

          var idFirstOrSecond = ($(Team).attr('ID') == TeamOffID) ? '' : '2'; // postfix for stats id selectors to target fields in first or second table

          var Individual_Statistics = d.find('Individual_Statistics[IS_TeamID="' + id + '"]'); // TeamID
          $(Individual_Statistics).children().each(function(i, AllStats){
            if (arrIDs[AllStats.nodeName])
            {
              var idselector = arrIDs[AllStats.nodeName].id;
              var nodeStart = arrIDs[AllStats.nodeName].start; // AllStats.nodeName.substr(0, AllStats.nodeName.length - 5); // need the part before Stats
              //var PlayerIDforThisListing = (nodeStart == "Rush" ? PlayerID_Rush : (nodeStart == "Receiving" ? PlayerID_Recv : PlayerID_Pass));
              $(AllStats).find(nodeStart + '_Listing').each(function(i2, Pass_Listing){
                //if ($(Pass_Listing).find(nodeStart + '_PlayerID').text() == PlayerIDforThisListing)
                //{
                  var Firstname = $(Pass_Listing).find(nodeStart + '_Firstname').text();
                  var Lastname = $(Pass_Listing).find(nodeStart + '_Lastname').text();
                  $('#'+idselector+idFirstOrSecond).html(Firstname + ' ' + Lastname);
                  switch (nodeStart)
                  {
                    case "Rush":
                      $("#lratt" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["ATT"] ).text() );
                      $("#lryds" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["YDS"] ).text() );
                      $("#lravg" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["AVG"] ).text() );
                      $("#gTDS"  +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["TD"]  ).text() );
                      break;
     
                    case "Pass":
                      $("#lpatt" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["ATT"] ).text() );
                      $("#lpComp"+idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["COMP"]).text() );
                      $("#lpYDS" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["YDS"] ).text() );
                      $("#lpTD"  +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["TD"]  ).text() );
                      $("#LPINT" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["INT"] ).text() );
                      break;
     
                    case "Receiving":
                      $("#lrrec" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["REC"] ).text() );
                      $("#lrryds"+idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["YDS"] ).text() );
                      $("#lrrAVG"+idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["AVG"] ).text() );
                      $("#lrrtd" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["TD"]  ).text() );
                      break;
                  }
                //}
              }); // each xxx_Listing
            }
          }); // each xxx_Stats
        //}
      }); // each Team

     if (d.find('Play').attr("Status").toUpperCase() === "FINAL") {
        clearInterval(myVar);
      }
    }
  });
}

Open in new window

0
 
Robert SchuttSoftware EngineerCommented:
capture
0
 
Robert SchuttSoftware EngineerCommented:
Note that I commented out the if ($(Team).attr('vh') == "H") because, as before, the each() is executed for both home and visitor and fills the appropriate fields. No 'global' if() necessary in that situation.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
powerztomAuthor Commented:
Perfect exactly what I wanted. And now I can test at 2:00 which I'm positive it will come up running successful Unlike Obama's Heathcare.gov. Did I say that ? anyway Excellent help from a Professional.
0
 
powerztomAuthor Commented:
Rob What I noticed that the leaders are the last players of the node that are being displayed in this case . I know there is some attribute to grab the first player in the start of the node that is available in his position. The way the xml is outputted is best to lowest in terms of yards and that is what I want to show is the first is it firstseq? The attribute  ?
0
 
Robert SchuttSoftware EngineerCommented:
It would be possible to loop through all listing nodes, determine the min or max of a certain subnode and the corresponding player id, then go back and use that listing. Or grab all info needed each time you see a lower/higher number in that field.

Ai ai ai, I just noticed that I posted about adding first() but it wasn't in the version of the code I posted, so it's overwriting the elements for each listing found, that's why it's showing the last!

Please try changing this first (line 44 in my posted code), then I'll also post an example of what I described before.
$(AllStats).find(nodeStart + '_Listing').first().each(function(i2, Pass_Listing){

Open in new window

0
 
Robert SchuttSoftware EngineerCommented:
So, this could be an alternative: keep a maximum in a var and only show values if the new value is higher (not terribly efficient, but if you need it like this then we can work on that...
            var MaxYards = 0;
            $(AllStats).find(nodeStart + '_Listing').each(function(i2, Pass_Listing){
              var newMaxYards = Number($(Pass_Listing).find(nodeStart + '_Yards').text());
              if (newMaxYards > MaxYards) {
                MaxYards = newMaxYards;
                var Firstname = $(Pass_Listing).find(nodeStart + '_Firstname').text();
                var Lastname = $(Pass_Listing).find(nodeStart + '_Lastname').text();
                $('#'+idselector+idFirstOrSecond).html(Firstname + ' ' + Lastname);
                switch (nodeStart)
                {
                  case "Rush":
                    $("#lratt" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["ATT"] ).text() );
                    $("#lryds" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["YDS"] ).text() );
                    $("#lravg" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["AVG"] ).text() );
                    $("#gTDS"  +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["TD"]  ).text() );
                    break;
   
                  case "Pass":
                    $("#lpatt" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["ATT"] ).text() );
                    $("#lpComp"+idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["COMP"]).text() );
                    $("#lpYDS" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["YDS"] ).text() );
                    $("#lpTD"  +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["TD"]  ).text() );
                    $("#LPINT" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["INT"] ).text() );
                    break;
   
                  case "Receiving":
                    $("#lrrec" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["REC"] ).text() );
                    $("#lrryds"+idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["YDS"] ).text() );
                    $("#lrrAVG"+idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["AVG"] ).text() );
                    $("#lrrtd" +idFirstOrSecond).html( $(Pass_Listing).find(nodeStart + '_' + arrIDs[AllStats.nodeName].attrs["TD"]  ).text() );
                    break;
                }
              } // if (newMaxYards > MaxYards)
            }); // each xxx_Listing

Open in new window

Note that the first() call is gone again now, and only a few lines have been added for checking the max value of xxx_Yards. You could easily change that to check for minimum and/or different node (xxx_Average or xxx_Longest).
0
 
powerztomAuthor Commented:
Thanks Rob,

I just got back from being off from work for like over a week. This is good stuff that I might be able to apply or use it in another situation.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.