[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

SNYTAX ERROR JAVASCRIPT

Posted on 2014-03-24
8
Medium Priority
?
226 Views
Last Modified: 2014-03-24
i'M CONVERTING INTERNAL WEB PAGE JAVASCRIPTS AND MAKING THEM EXTERNAL. And I'M MISSING SOMETHING AGAIN PLEASE HELP EASY 500

// JavaScript Document
 var QueryString = function () {
	var query_string = {};
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");
		// If first entry with this name
		if (typeof query_string[pair[0]] === "undefined") {
			query_string[pair[0]] = pair[1];
		// If second entry with this name
		} else if (typeof query_string[pair[0]] === "string") {
			var arr = [ query_string[pair[0]], pair[1] ];
			query_string[pair[0]] = arr;
		// If third or later entry with this name
		} else {
			query_string[pair[0]].push(pair[1]);
		}
	} 
	return query_string;
} ();  
var xmlPath = '/xml/mlb/scores/real';
var xmlGameID =  QueryString.gameID;
function startup(){
    $.ajax({
        type: "GET",
        url:  xmlPath+"/"+xmlGameID+ ".xml",
        dataType: "xml",
        success: function(data) {
            var d = $(data);
            d.find('Team').each(function(i,Team){
                var team=$(Team);
                var id = team.attr("ID").toLowerCase();
                var teamname = team.attr("name");
                var homeOrAway = team.attr("vh");
               
                var d = $(data);
                d.find('Team').each(function(i,Team){
                    if ($(Team).attr('vh') == "H") {

                       $('#hometeam').attr('src', 'http://sportsnetwork.com/gamecast/images/MLB PS/'+$(Team).attr('ID')+".png");
//}

					 var HS1 = $(Team).find('Linescore');
         // var hs2 = HS1.attr('Score');
          $('#HS').html(HS1.attr('Runs'));
		  }
                })
                d.find('Team').each(function(i,Team){
                    if ($(Team).attr('vh') == "A") {

                    $('#awayteam').attr('src', 'http://sportsnetwork.com/gamecast/images/MLB PS/'+$(Team).attr('ID')+".png");
//}

					 var VS1 = $(Team).find('Linescore');
         // var vs2 = VS1.attr('Score');
          $('#VS').html(VS1.attr('Runs'));
		  }
                });
            });
        var myVar = setInterval(loadData, 1000);
        }
		
    });
	
});


   function loadData() {
  $.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){

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

$('#awayteam').attr('src', 'http://sportsnetwork.com/gamecast/images/MLB PS/'+$(Team).attr('ID')+".png");


		  var VS1 = $(Team).find('Linescore');
         
          $('#VS').html(VS1.attr('Runs'));

		 

        }
		 var d = $(data);
		 d.find('Team').each(function(i,Team){
        if ($(Team).attr('vh') == "H") {

          var HS1 = $(Team).find('Linescore');
         
          $('#HS').html(HS1.attr('Runs'));
		$('#hometeam').attr('src', 'http://sportsnetwork.com/gamecast/images/MLB PS/'+$(Team).attr('ID')+".png");
         


        }
     });
	  });// each
        // changed all below to just use the variables that contain the text directly, as the arrays do not exist and don't seem necessary in this situation
      // quarter[qtr]
     // ++counterXml;
    }
  }); //ajax

  }

Open in new window

0
Comment
Question by:powerztom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39950790
...and the error is???
0
 

Author Comment

by:powerztom
ID: 39951088
Gary i'm missing a bracket or brace?
0
 
LVL 58

Expert Comment

by:Gary
ID: 39951109
The function startup(){} has an extra closing bracket - line 66 in your code above.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:powerztom
ID: 39951149
then I get a syntax error on 112.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39951171
Did you remove the bracket or the curly? Remove the bracket -> )
0
 

Author Comment

by:powerztom
ID: 39951374
Just a error sits at 112

var xmlPath = '/xml/mlb/scores/real';
var xmlGameID = '41593';
function startup() {
    $.ajax({
        type: "GET",
        url:  xmlPath+"/"+xmlGameID+ ".xml",
        dataType: "xml",
        success: function(data) {
            var d = $(data);
            d.find('Team').each(function(i,Team){
                var team=$(Team);
                var id = team.attr("ID").toLowerCase();
                var teamname = team.attr("name");
                var homeOrAway = team.attr("vh");
               
                var d = $(data);
                d.find('Team').each(function(i,Team){
                    if ($(Team).attr('vh') == "H") {

                       $('#hometeam').attr('src', 'http://images.sportsnetwork.com/MLB/ATTHEBALLPARK/MLB/'+$(Team).attr('ID')+".png");
//}

					 var HS1 = $(Team).find('Linescore');
         // var hs2 = HS1.attr('Score');
          $('#HS').html(HS1.attr('Runs'));
		  }
                })
                d.find('Team').each(function(i,Team){
                    if ($(Team).attr('vh') == "A") {

                    $('#awayteam').attr('src', 'http://images.sportsnetwork.com/MLB/ATTHEBALLPARK/MLB/'+$(Team).attr('ID')+".png");
//}

					 var VS1 = $(Team).find('Linescore');
         // var vs2 = VS1.attr('Score');
          $('#VS').html(VS1.attr('Runs'));
		  }
                });
            });
        var myVar = setInterval(loadData, 2000);
        }
    });

   function loadData() {
  $.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){

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

$('#awayteam').attr('src', 'http://images.sportsnetwork.com/MLB/ATTHEBALLPARK/MLB/'+$(Team).attr('ID')+".png");


		  var VS1 = $(Team).find('Linescore');
         
          $('#VS').html(VS1.attr('Runs'));

		 

        }
		 var d = $(data);
		 d.find('Team').each(function(i,Team){
        if ($(Team).attr('vh') == "H") {

          var HS1 = $(Team).find('Linescore');
         
          $('#HS').html(HS1.attr('Runs'));
		$('#hometeam').attr('src', 'http://images.sportsnetwork.com/MLB/ATTHEBALLPARK/MLB/'+$(Team).attr('ID')+".png");
         


        }
     });
	  });// each
        // changed all below to just use the variables that contain the text directly, as the arrays do not exist and don't seem necessary in this situation
      // quarter[qtr]
     // ++counterXml;
    }
  }); //ajax

  }

Open in new window

0
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 39951385
var xmlPath = '/xml/mlb/scores/real';
var xmlGameID = '41593';
function startup() {
    $.ajax({
        type: "GET",
        url:  xmlPath+"/"+xmlGameID+ ".xml",
        dataType: "xml",
        success: function(data) {
            var d = $(data);
            d.find('Team').each(function(i,Team){
                var team=$(Team);
                var id = team.attr("ID").toLowerCase();
                var teamname = team.attr("name");
                var homeOrAway = team.attr("vh");
               
                var d = $(data);
                d.find('Team').each(function(i,Team){
                    if ($(Team).attr('vh') == "H") {

                       $('#hometeam').attr('src', 'http://images.sportsnetwork.com/MLB/ATTHEBALLPARK/MLB/'+$(Team).attr('ID')+".png");
//}

					 var HS1 = $(Team).find('Linescore');
         // var hs2 = HS1.attr('Score');
          $('#HS').html(HS1.attr('Runs'));
		  }
                })
                d.find('Team').each(function(i,Team){
                    if ($(Team).attr('vh') == "A") {

                    $('#awayteam').attr('src', 'http://images.sportsnetwork.com/MLB/ATTHEBALLPARK/MLB/'+$(Team).attr('ID')+".png");
//}

					 var VS1 = $(Team).find('Linescore');
         // var vs2 = VS1.attr('Score');
          $('#VS').html(VS1.attr('Runs'));
		  }
                });
            });
        var myVar = setInterval(loadData, 2000);
        }
    });
}
   function loadData() {
  $.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){

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

$('#awayteam').attr('src', 'http://images.sportsnetwork.com/MLB/ATTHEBALLPARK/MLB/'+$(Team).attr('ID')+".png");


		  var VS1 = $(Team).find('Linescore');
         
          $('#VS').html(VS1.attr('Runs'));

		 

        }
		 var d = $(data);
		 d.find('Team').each(function(i,Team){
        if ($(Team).attr('vh') == "H") {

          var HS1 = $(Team).find('Linescore');
         
          $('#HS').html(HS1.attr('Runs'));
		$('#hometeam').attr('src', 'http://images.sportsnetwork.com/MLB/ATTHEBALLPARK/MLB/'+$(Team).attr('ID')+".png");
         


        }
     });
	  });// each
        // changed all below to just use the variables that contain the text directly, as the arrays do not exist and don't seem necessary in this situation
      // quarter[qtr]
     // ++counterXml;
    }
  }); //ajax

  }

Open in new window

0
 

Author Closing Comment

by:powerztom
ID: 39951498
Gary thank you for swifting through my code and eliminating syntaxv errors. I have like 3 or 4 more to go.I'mm a vb script guy with not being useded to brackets and braces.Thanks Gary
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn how to count occurrences of each item in an array.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question