Trying to do a QB Comparison in Javascript and jquery pulling xml

Hey I'm trying to pull xml to Compare QB in a game but thus far I'm having zero luck Could someone assist please Help? Here is my code I'll hardcode a xml so there is enough stats accumulated to make a good comparison. This is set to just get Away QB But I was wondering if there was a simply way to grab both with less code however this doesn't pull xml. I hardcoded a xml file so if you can get it to work you can see the QB Comparison. Thanks EE

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<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/nfl/scores/real';
  var xmlGameID = 'AB-3171'; // game id only, _counter.xml will be added in the ajax call
  var counterXml = 1;
 var TeamIDH = 0;
  var TeamIDA = 0;
  var teamNames = {
    "079": "GIANTS",
    "068": "LIONS",
    "084": "49ERS",
    "063": "BEARS",
    "083": "CHARGERS",
    "085": "SEAHAWKS",
    "088": "REDSKINS",
    "061": "FALCONS",
    "062": "BILLS",
    "064": "BENGALS",
    "065": "RAVENS",
    "066": "COWBOYS",
    "067": "BRONCOS",
    "069": "PACKERS",
    "070": "TITANS",
    "071": "COLTS",
    "072": "CHIEFS",
    "073": "RAIDERS",
    "074": "RAMS",
    "075": "DOLPHINS",
    "076": "VIKINGS",
    "077": "PATRIOTS",
    "078": "SAINTS",
    "080": "JETS",
    "081": "EAGLES",
    "082": "STEELERS",
    "086": "CARDINALS",
    "087": "BUCS",
    "089": "PANTHERS",
    "090": "JAGUARS",
    "120": "BROWNS",
    "151": "TEXANS",
    "685": "A-F-C",
    "686": "N-F-C"
  };
   var sPlayerImagePath = 'http://images.sportsnetwork.com/nfl/atthegridiron/players/';
  var sBlankImage = 'Blank.png';
    $(document).ready(function () {
                $.ajax({
                    type: "GET",
                    url: xmlPath + "/" + xmlGameID + "_0.xml",
                    dataType: "xml",
                    success: function (data) {
                        var d = $(data);
                        d.find('Team').each(function (i, Team) {
                            var team = $(Team);
                            

                            //$(selector1).html(teamname);
                            // $(selector2).html(teamNames[id]);
                            if ($(Team).attr('vh') == "A") {
                                 TeamIDA = $(Team).attr('ID');
                                $('#TeamIDA').html(TeamIDA);

                                $('#Ateam1').attr('src', 'http://199.233.14.112/aspdata/nfl2/' + $(Team).attr('ID')+ ".png");
                               
                                // $('#VRd').show()
                                // $('#VRtg').show()

                            }
                            if ($(Team).attr('vh') == "H") {
                                TeamIDH = $(Team).attr('ID');
                                $('#TeamIDH').html(TeamIDH);
                                $('#Hteam1').attr('src', 'http://199.233.14.112/aspdata/nfl2/' + $(Team).attr('ID') + ".png");
                               
                            }

                        });
                    }
                });
				});
function loadData()
{
  $.ajax(
  {
    type: "GET",
    url: xmlPath + "/" + xmlGameID + '_' + counterXml + ".xml",
    dataType: "xml",
    success: function (data) 
    {
      var d = $(data);
      var Play = d.find('Play');
      var TeamDefID = $(Play).attr('POSSID');
      var Team = d.find('Team[ID="' + TeamIDefID + '"]');
      var TeamName = $(Team).attr('name') ;
      var selHomeOrAway = $(Team).attr('name') == "H" ? "home" : "away";
     

      var Individual_Statistics = d.find('Individual_Statistics[IS_TeamID="' + TeamIDefID + '"]');
      var Passing_Stats = $(Individual_Statistics).find('Passing_Stats');
      
			$(Passing_Stats).find('Passing_Listing').each(function(i2, Pass_Listing){
	 var PlayerID = $(Pass_Listing).find('Pass_PlayerID').text();
        var PlayerImgSrc = (PlayerID > 0 ? sPlayerImagePath + PlayerID + ".jpg" : sBlankImage);
        var Firstname = $(Pass_Listing).find('Pass_Firstname').text();
        var Lastname = $(Pass_Listing).find('Pass_Lastname').text();
			 var AAttempts = $(Pass_Listing).find('Pass_Attempts').text();
        var ACompletions = $(Pass_Listing).find('Pass_Completions').text();
		var AYards = $(Pass_Listing).find('Pass_Yards').text();
        var ASacked = $(Pass_Listing).find('Pass_Sacked').text();
			 var ATds = $(Pass_Listing).find('Pass_Touchdowns').text();
        var AInterceptions = $(Pass_Listing).find('Pass_Interceptions').text();
		var ALongest = $(Pass_Listing).find('Pass_Longest').text();
		$('#AFirstname').html(Firstname);
		$('#ALastname').html(Lastname);	
		$('#Aaats').html(AAttempts);
		$('#AComp').html(ACompletions);
		$('#AYards').html(AYards);
		$('#ASacked').html(Sacked);	
		$('#ATd').html(ATds);
		$('#AInt').html(AInterceptions);
		$('#ALong').html(ALongest);
		$('#AimgQB').attr('src', PlayerImgSrc);	
		$('#AimgTeam').attr('src', 'http://199.233.14.112/aspdata/nfl2/' + TeamIDA + ".png");
				 });
				  // each
      ++counterXml;
    },
    error: function() {
      // for testing!
      --counterXml;
    }
  }); //ajax
}
</script>
</head>

<body> 
<table width="700" border="0">
  <tr>
    <td><table width="100%" border="0">
      <tr>
        <td width="21%"><img src="061.png" name="AimgTeam" width="43" height="36" id="AimgTeam"><img src="Images/QB.png" name="AimgQB" width="50" height="50" id="AimgQB"></td>
        <td width="14%" id="AFirstname">Firstname </td>
        <td width="15%" id="ALastname">Lastname</td>
        <td width="23%"><img src="068.png" name="home" width="56" height="42" id="home"><img src="Images/QB.png" alt="" name="HimgQB" width="50" height="50" id="HimgQB"></td>
        <td width="13%" id="HFirstname">Firstname </td>
        <td width="14%" id="HLastname">Lastname</td>
      </tr>
      <tr>
        <td>Attempts</td>
        <td colspan="2" id="Aaats">Aatts</td>
        <td>Attempts</td>
        <td colspan="2">Hatts</td>
      </tr>
      <tr>
        <td>Completions</td>
        <td colspan="2" id="AComp">AComp</td>
        <td>Completions</td>
        <td colspan="2">HComp</td>
      </tr>
      <tr>
        <td>Yards</td>
        <td colspan="2" id="AYards">AYards</td>
        <td>Yards</td>
        <td colspan="2">Hyards</td>
      </tr>
      <tr>
        <td>Sacked</td>
        <td colspan="2" id="ASacked">ASacked</td>
        <td>Sacked</td>
        <td colspan="2">HSacked</td>
      </tr>
      <tr>
        <td>Touchdowns</td>
        <td colspan="2" id="ATd">ATd</td>
        <td>Touchdowns</td>
        <td colspan="2">Htd</td>
      </tr>
      <tr>
        <td>Interceptions</td>
        <td colspan="2" id="AInt">AInt</td>
        <td>Interceptions</td>
        <td colspan="2">Hint</td>
      </tr>
      <tr>
        <td>Longest</td>
        <td colspan="2" id="ALong">ALong</td>
        <td>Longest</td>
        <td colspan="2">HLong</td>
      </tr>
    </table>
      <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <table width="100%" border="0">
      <tr>
        <td id="TeamIDA"><img src="061.png" alt="" name="Ateam1" width="43" height="36" id="Ateam1">TeamIDA</td>
      </tr>
      <tr>
        <td id="TeamIDH"><img src="068.png" alt="" name="Hteam1" width="56" height="42" id="Hteam1">TeamIDH</td>
      </tr>
    </table>
    <p>&nbsp;</p></td>
  </tr>
</table>
<script>
var myVar=setInterval(function(){myTimer()},1000);

function myTimer()
{
  loadData();
}
</script>
</body>
</html>

Open in new window

sTUFF.zip
powerztomAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Robert SchuttSoftware EngineerCommented:
First, I corrected a number of typos/inconsistencies to make it run.
function loadData()
{
  $.ajax(
  {
    type: "GET",
    url: xmlPath + "/" + xmlGameID + '_' + counterXml + ".xml",
    dataType: "xml",
    success: function (data) 
    {
      var d = $(data);
      var Play = d.find('Play');
      var TeamDefID = $(Play).attr('PossID'); // xml is case sensitive!
      var Team = d.find('Team[ID="' + TeamDefID + '"]'); // was TeamIDefID?
      //var TeamName = $(Team).attr('name') ; // unused
      //var selHomeOrAway = $(Team).attr('vh') == "H" ? "home" : "away"; // corrected 'name' to 'vh' but is unused

      var Individual_Statistics = d.find('Individual_Statistics[IS_TeamID="' + TeamDefID + '"]'); // was TeamIDefID?
      var Passing_Stats = $(Individual_Statistics).find('Passing_Stats');
      
      $(Passing_Stats).find('Pass_Listing').each(function(i2, Pass_Listing){ // was Passing_Listing
        var PlayerID = $(Pass_Listing).find('Pass_PlayerID').text();
        var PlayerImgSrc = (PlayerID > 0 ? sPlayerImagePath + PlayerID + ".jpg" : sBlankImage);
        var Firstname = $(Pass_Listing).find('Pass_Firstname').text();
        var Lastname = $(Pass_Listing).find('Pass_Lastname').text();
        var AAttempts = $(Pass_Listing).find('Pass_Attempts').text();
        var ACompletions = $(Pass_Listing).find('Pass_Completions').text();
        var AYards = $(Pass_Listing).find('Pass_Yards').text();
        var ASacked = $(Pass_Listing).find('Pass_Sacked').text();
        var ATds = $(Pass_Listing).find('Pass_Touchdowns').text();
        var AInterceptions = $(Pass_Listing).find('Pass_Interceptions').text();
        var ALongest = $(Pass_Listing).find('Pass_Longest').text();
        $('#AFirstname').html(Firstname);
        $('#ALastname').html(Lastname);	
        $('#Aaats').html(AAttempts);
        $('#AComp').html(ACompletions);
        $('#AYards').html(AYards);
        $('#ASacked').html(Sacked);	
        $('#ATd').html(ATds);
        $('#AInt').html(AInterceptions);
        $('#ALong').html(ALongest);
        $('#AimgQB').attr('src', PlayerImgSrc);	
        $('#AimgTeam').attr('src', 'http://199.233.14.112/aspdata/nfl2/' + TeamIDA + ".png");
      }); // each
    //  ++counterXml;
    },
    error: function() {
      // for testing!
   //   --counterXml;
    }
  }); //ajax
}

Open in new window

what I don't understand is why you look at PossID, it doesn't seem to me that you can determine home/away from that. Wouldn't you just want to each() over the <Team> nodes and use attribute vh as before? maybe:
function loadData()
{
  $.ajax(
  {
    type: "GET",
    url: xmlPath + "/" + xmlGameID + '_' + counterXml + ".xml",
    dataType: "xml",
    success: function (data) 
    {
      var d = $(data);
      //var Play = d.find('Play');
      d.find('Team').each(function(i, Team){
        var TeamID = $(Team).attr('ID');
        //var TeamName = $(Team).attr('name') ; // unused
        var selHomeOrAway = $(Team).attr('vh') == "H" ? "home" : "away";

        var Individual_Statistics = d.find('Individual_Statistics[IS_TeamID="' + TeamID + '"]');
        var Passing_Stats = $(Individual_Statistics).find('Passing_Stats');
        
        $(Passing_Stats).find('Pass_Listing').each(function(i2, Pass_Listing){
          var PlayerID = $(Pass_Listing).find('Pass_PlayerID').text();
          var PlayerImgSrc = (PlayerID > 0 ? sPlayerImagePath + PlayerID + ".jpg" : sBlankImage);
          var Firstname = $(Pass_Listing).find('Pass_Firstname').text();
          var Lastname = $(Pass_Listing).find('Pass_Lastname').text();
          var AAttempts = $(Pass_Listing).find('Pass_Attempts').text();
          var ACompletions = $(Pass_Listing).find('Pass_Completions').text();
          var AYards = $(Pass_Listing).find('Pass_Yards').text();
          var ASacked = $(Pass_Listing).find('Pass_Sacked').text();
          var ATds = $(Pass_Listing).find('Pass_Touchdowns').text();
          var AInterceptions = $(Pass_Listing).find('Pass_Interceptions').text();
          var ALongest = $(Pass_Listing).find('Pass_Longest').text();
          $('#' + $(Team).attr('vh') + 'Firstname').html(Firstname);
          $('#' + $(Team).attr('vh') + 'Lastname').html(Lastname);	
          $('#' + $(Team).attr('vh') + 'aats').html(AAttempts);
          $('#' + $(Team).attr('vh') + 'Comp').html(ACompletions);
          $('#' + $(Team).attr('vh') + 'Yards').html(AYards);
          $('#' + $(Team).attr('vh') + 'Sacked').html(ASacked);	
          $('#' + $(Team).attr('vh') + 'Td').html(ATds);
          $('#' + $(Team).attr('vh') + 'Int').html(AInterceptions);
          $('#' + $(Team).attr('vh') + 'Long').html(ALongest);
          $('#' + $(Team).attr('vh') + 'imgQB').attr('src', PlayerImgSrc);	
          $('#' + $(Team).attr('vh') + 'imgTeam').attr('src', 'http://199.233.14.112/aspdata/nfl2/' + TeamID + ".png");
        }); // each
      });
    //  ++counterXml;
    },
    error: function() {
      // for testing!
   //   --counterXml;
    }
  }); //ajax
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Robert SchuttSoftware EngineerCommented:
For that second js, also the html:
<body> 
<table width="700" border="0">
  <tr>
    <td><table width="100%" border="0">
      <tr>
        <td width="21%"><img src="061.png" name="AimgTeam" width="43" height="36" id="AimgTeam"><img src="Images/QB.png" name="AimgQB" width="50" height="50" id="AimgQB"></td>
        <td width="14%" id="AFirstname">Firstname </td>
        <td width="15%" id="ALastname">Lastname</td>
        <td width="23%"><img src="068.png" name="HimgTeam" width="56" height="42" id="HimgTeam"><img src="Images/QB.png" alt="" name="HimgQB" width="50" height="50" id="HimgQB"></td>
        <td width="13%" id="HFirstname">Firstname </td>
        <td width="14%" id="HLastname">Lastname</td>
      </tr>
      <tr>
        <td>Attempts</td>
        <td colspan="2" id="Aaats">Aatts</td>
        <td>Attempts</td>
        <td colspan="2" id="Haats">Hatts</td>
      </tr>
      <tr>
        <td>Completions</td>
        <td colspan="2" id="AComp">AComp</td>
        <td>Completions</td>
        <td colspan="2" id="HComp">HComp</td>
      </tr>
      <tr>
        <td>Yards</td>
        <td colspan="2" id="AYards">AYards</td>
        <td>Yards</td>
        <td colspan="2" id="HYards">Hyards</td>
      </tr>
      <tr>
        <td>Sacked</td>
        <td colspan="2" id="ASacked">ASacked</td>
        <td>Sacked</td>
        <td colspan="2" id="HSacked">HSacked</td>
      </tr>
      <tr>
        <td>Touchdowns</td>
        <td colspan="2" id="ATd">ATd</td>
        <td>Touchdowns</td>
        <td colspan="2" id="HTd">Htd</td>
      </tr>
      <tr>
        <td>Interceptions</td>
        <td colspan="2" id="AInt">AInt</td>
        <td>Interceptions</td>
        <td colspan="2" id="HInt">Hint</td>
      </tr>
      <tr>
        <td>Longest</td>
        <td colspan="2" id="ALong">ALong</td>
        <td>Longest</td>
        <td colspan="2" id="HLong">HLong</td>
      </tr>
    </table>

Open in new window

0
powerztomAuthor Commented:
Awesome code Is there any way to grab Current Leaders for QB And Display the stats of the Quarterback that has the most yards for his team.

I tried but today my mind is cloudy but this code here I created is flukey it disnot display player image for his team. Attached is a copy of newer html file with IP Address to display graphics Eagles should show Michael Vick instead of Kevin Kolb. Just a little extra work I'm sorry.

  var PossID = $(Play).attr('PossID');
      var CurrentLeaders = d.find('CurrentLeaders');
      var Passing = $(CurrentLeaders).find('Passing[TeamID="' + PossID + '"]');
        var Individual_Statistics = d.find('Individual_Statistics[IS_TeamID="' + TeamID + '"]');
        var Passing_Stats = $(Individual_Statistics).find('Passing_Stats');
        var PlayerID = Passing.attr('PlayerID');

Open in new window

0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

powerztomAuthor Commented:
Magical Code. This guy is a javascript wizard. Best on EE no Doubt!
0
Robert SchuttSoftware EngineerCommented:
Attached is a copy of newer html file
There is a bit of code but no attachment.
0
Robert SchuttSoftware EngineerCommented:
Best on EE no Doubt
Well now, I wouldn't go so far. Maybe a bit more patient (on a good day) than some others ;-)
0
powerztomAuthor Commented:
Player head shots are the same just need to show Current Leaders at QB that way I can use that code to do RB AND WR. Almost there. The code I added I screwed it up trying to get Current Leaders
QBCompare.html
AB-3171-167.xml
0
Robert SchuttSoftware EngineerCommented:
The code you posted "works" (gets Player ID 948) but I guess it needs to be connected to each other in the sense that you want the Passing_Stats for the player defined as the current leader for each team. It often helps if you just write down the requirement in words like that, then you can almost literally convert that to code which gets the right attributes from the xml. Hope that clears up the cloud a bit ;-)
0
Robert SchuttSoftware EngineerCommented:
Well, I still feel PossID is no good, try this:
function loadData()
{
  $.ajax(
  {
    type: "GET",
    url: xmlPath + "/" + xmlGameID + '_' + counterXml + ".xml",
    dataType: "xml",
    success: function (data) 
    {
      var d = $(data);
      d.find('Team').each(function(i, Team){
        var TeamID = $(Team).attr('ID');
        //var TeamName = $(Team).attr('name') ; // unused
        var selHomeOrAway = $(Team).attr('vh') == "H" ? "home" : "away";

        var CurrentLeaders = d.find('CurrentLeaders');

        var Individual_Statistics = d.find('Individual_Statistics[IS_TeamID="' + TeamID + '"]');
        var Passing_Stats = $(Individual_Statistics).find('Passing_Stats');

        $(Passing_Stats).find('Pass_Listing').each(function(i2, Pass_Listing){
         // var PlayerID = $(Pass_Listing).find('Pass_PlayerID').text();

          var Passing = $(CurrentLeaders).find('Passing[TeamID="' + TeamID + '"]');
          var PlayerID = Passing.attr('PlayerID');

          var PlayerImgSrc = (PlayerID > 0 ? sPlayerImagePath + PlayerID + ".jpg" : sBlankImage);
          var Firstname = $(Pass_Listing).find('Pass_Firstname').text();
          var Lastname = $(Pass_Listing).find('Pass_Lastname').text();
          var AAttempts = $(Pass_Listing).find('Pass_Attempts').text();
          var ACompletions = $(Pass_Listing).find('Pass_Completions').text();
          var AYards = $(Pass_Listing).find('Pass_Yards').text();
          var ASacked = $(Pass_Listing).find('Pass_Sacked').text();
          var ATds = $(Pass_Listing).find('Pass_Touchdowns').text();
          var AInterceptions = $(Pass_Listing).find('Pass_Interceptions').text();
          var ALongest = $(Pass_Listing).find('Pass_Longest').text();
          $('#' + $(Team).attr('vh') + 'Firstname').html(Firstname);
          $('#' + $(Team).attr('vh') + 'Lastname').html(Lastname);	
          $('#' + $(Team).attr('vh') + 'aats').html(AAttempts);
          $('#' + $(Team).attr('vh') + 'Comp').html(ACompletions);
          $('#' + $(Team).attr('vh') + 'Yards').html(AYards);
          $('#' + $(Team).attr('vh') + 'Sacked').html(ASacked);	
          $('#' + $(Team).attr('vh') + 'Td').html(ATds);
          $('#' + $(Team).attr('vh') + 'Int').html(AInterceptions);
          $('#' + $(Team).attr('vh') + 'Long').html(ALongest);
          $('#' + $(Team).attr('vh') + 'imgQB').attr('src', PlayerImgSrc);	
          $('#' + $(Team).attr('vh') + 'imgTeam').attr('src', 'http://199.233.14.112/aspdata/nfl2/' + TeamID + ".png");
        }); // each
      });
      ++counterXml;
    },
    error: function() {
      // for testing!
   //   --counterXml;
    }
  }); //ajax
}

Open in new window

0
powerztomAuthor Commented:
Rob,

http://199.233.14.112/aspdata/nfl2/QBCompare.html I sped up the timer I need to get image right cause Kevin kolb of Eagles is a white dude Michael vick is a Black Dude. And for some reason Michael vick total Passing Yards is 190 yards as of AB-3171_171.xml Is there a way to just auto increment in case a file is missing You did it somewhere where if 7 for example was missing you wrote it to jump from 6 to 8 if for ezample again 7 was missing Michael Vick Total Passing Yards is 190. Check out link provided. My brain is not working today need to borrow yours and I promise to give it back to ya! Please help
AB-3171-172.xml
QBCompare.html
0
powerztomAuthor Commented:
graphic
Stops here kevin Kolb is a white dude
0
Robert SchuttSoftware EngineerCommented:
The increment solution is here: http:/Q_28208150.html

Quick fix for getting the info from the first Pass_Listing (hoping that matches the current leader):
$(Passing_Stats).find('Pass_Listing').first().each(function(i2, Pass_Listing){
0
Robert SchuttSoftware EngineerCommented:
Otherwise, maybe we need to go through all Pass_Listing nodes and find the corresponding player, you did something like that already on http:/Q_28176017.html
0
powerztomAuthor Commented:
This works providing that the first node is the one who has most yards

$(Passing_Stats).find('Pass_Listing').first().each(function(i2, Pass_Listing){

Thanks Rob I think this should work but I'm going to investigate.
0
Robert SchuttSoftware EngineerCommented:
I think this is much better than the quick fix:
function loadData()
{
  $.ajax(
  {
    type: "GET",
    url: xmlPath + "/" + xmlGameID + '_' + counterXml + ".xml",
    dataType: "xml",
    success: function (data) 
    {
      var d = $(data);
      d.find('Team').each(function(i, Team){
        var TeamID = $(Team).attr('ID');
        //var TeamName = $(Team).attr('name') ; // unused
        var selHomeOrAway = $(Team).attr('vh') == "H" ? "home" : "away";

        var CurrentLeaders = d.find('CurrentLeaders');

        var Individual_Statistics = d.find('Individual_Statistics[IS_TeamID="' + TeamID + '"]');
        var Passing_Stats = $(Individual_Statistics).find('Passing_Stats');

        var Passing = $(CurrentLeaders).find('Passing[TeamID="' + TeamID + '"]');
        var PlayerID = Passing.attr('PlayerID');

        $(Passing_Stats).find('Pass_Listing').each(function(i2, Pass_Listing){
          if ($(Pass_Listing).find('Pass_PlayerID').text() == PlayerID) {
            var PlayerImgSrc = (PlayerID > 0 ? sPlayerImagePath + PlayerID + ".jpg" : sBlankImage);
            var Firstname = $(Pass_Listing).find('Pass_Firstname').text();
            var Lastname = $(Pass_Listing).find('Pass_Lastname').text();
            var AAttempts = $(Pass_Listing).find('Pass_Attempts').text();
            var ACompletions = $(Pass_Listing).find('Pass_Completions').text();
            var AYards = $(Pass_Listing).find('Pass_Yards').text();
            var ASacked = $(Pass_Listing).find('Pass_Sacked').text();
            var ATds = $(Pass_Listing).find('Pass_Touchdowns').text();
            var AInterceptions = $(Pass_Listing).find('Pass_Interceptions').text();
            var ALongest = $(Pass_Listing).find('Pass_Longest').text();
            $('#' + $(Team).attr('vh') + 'Firstname').html(Firstname);
            $('#' + $(Team).attr('vh') + 'Lastname').html(Lastname);	
            $('#' + $(Team).attr('vh') + 'aats').html(AAttempts);
            $('#' + $(Team).attr('vh') + 'Comp').html(ACompletions);
            $('#' + $(Team).attr('vh') + 'Yards').html(AYards);
            $('#' + $(Team).attr('vh') + 'Sacked').html(ASacked);	
            $('#' + $(Team).attr('vh') + 'Td').html(ATds);
            $('#' + $(Team).attr('vh') + 'Int').html(AInterceptions);
            $('#' + $(Team).attr('vh') + 'Long').html(ALongest);
            $('#' + $(Team).attr('vh') + 'imgQB').attr('src', PlayerImgSrc);	
            $('#' + $(Team).attr('vh') + 'imgTeam').attr('src', 'http://199.233.14.112/aspdata/nfl2/' + TeamID + ".png");
          }

        }); // each
      });
      ++counterXml;
    },
    error: function() {
      // for testing!
   //   --counterXml;
    }
  }); //ajax
}

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.