onchange event error

I get the following error:
SCRIPT5007: The value of the property 'selectQry' is null or undefined, not a Function object
Here's the site: http://isaac.issharepoint.com/demo/pages/iceCreamTruckTracker.aspx

Here's the code if you can't get to the site:

<script>

		<select id="qry" onchange="selectQry()">
		   <option value="State">State</option>
		   <option value="Town Name">Town Name</option>
		   <option value="County Name">County Name</option>
		</select>

$(document).ready(function() { 

//onchange event will trigger getArrayCount() method


	function selectQry(list) {
	var qryVal = list.options[list.selectedIndex].value;
	console.log("Selected selection: "+qryVal);
	
}
//Create name space so their will be no collisions if application grows
	var iceCreamApp = {};
	iceCreamApp.Truck = new Array();
	
	//Load data from list into array right away
	(function() {
		//IIFE() Imediately Invoked Function
		var url = "http://isaac.issharepoint.com/demo/_vti_bin/listdata.svc/IceCreamTrucks?$select=State,TownName,CountyName,IceCreamTrucks";
		$.ajax({
			url:url,
			type:"GET",
			dataType:"json",
			headers: {
                "accept": "application/json;odata=verbose",
                "X-RequestDigest": $("#__REQUESTDIGEST").val()
            },
			success: function(data) {
			//console.log(data.d);
				success(data);
			},
			error: function(data) {
				//failure(data);
				//console.log("ERROR");
			}
		})
			
		function success(data)
		{
			var iceCreamTrucks = data.d.results;
				for(var i = 0; i<iceCreamTrucks.length; i++)
				{
					iceCreamApp.Truck.push(new ICIItem({State:iceCreamTrucks[i].State,
					                           TownName:iceCreamTrucks[i].TownName,
											   CountyName:iceCreamTrucks[i].CountyName,
											   TruckCnt:iceCreamTrucks[i].IceCreamTrucks}));
				}
		}
	}());	
})


function ICIItem(params)
{
	this.TruckCnt = params.TruckCnt;
	if (this.TruckCnt > 5)
	{
		//do something
	}	
	this.State = params.State;
	this.TownName = params.TownName;
	this.CountyName = params.CountyName;
};
ICIItem.prototype.getArrayCount = function(cntType)
{
//Build array number of trucks based on town, state or county. Will be passed in as "cntType"

//pass array to function that will use jqplot
}
		$.each(ticketArray, function (index, value) {			
        		myData.push([ticketArray[index].TicketType, ticketArray[index].Count]);	
 		});
		
	
</script>

Open in new window

LVL 5
IsaacSharePoint Client Side DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Brian TaoSenior Business Solutions ConsultantCommented:
The cause of the error is that you have 2 sets of <html><head></head><body></body></html> so the .js file linked in the 2nd set is not recognized by your browser.

BTW, reading your source from "View Source" is really painful.  Have you ever considered cleaning it up?  By cleaning it up I guess you'd have already found such issue.
0
IsaacSharePoint Client Side DeveloperAuthor Commented:
Most of the code you saw was generated by SharePoint and was not completely my code but thanks for the suggestion.
0
IsaacSharePoint Client Side DeveloperAuthor Commented:
Can't figure out what the issue is
<script type="text/javascript" src="http://isaac.issharepoint.com/demo/JavaScriptCode/TesticeCreamTrucks.js"></script>

<table>
	<tr>
		<td colspan="2"></td>
	</tr>
	<tr>
		<td colspan="2">
		<select id="qry" onchange="selectQry()">
		   <option value="State">State
		   <option value="Town Name">Town Name
		   <option value="County Name">County Name
		</select>
		</td>
	</tr>	
	<tr>
		<td></td>
		<td></td>
	</tr>
</table>

Open in new window



TesticeCreamTrucks.js
<script type="text/javascript">
$(document).ready(function() { 
alert("HELLO");

	
})

function selectQry()
{
   alert("HELLO WORLD");
}
</script>

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.

Brian TaoSenior Business Solutions ConsultantCommented:
1. don't include <script type="text/javascript"> and </script> in a js file (TesticeCreamTrucks.js).
2. documentGetElementsByName is not defined: there's documentGetElementsByName somewhere in your code.  It should be document.getElementsByName (note that you missed a dot (.) and the (G)et should be lower case g.

Note. since I'm unauthorized and banned from entering the site, there's some other bugs that I think may come from the unauthorization so I'm skipping them now.

Let me know if you still have problem after you fix these 2 things.
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
IsaacSharePoint Client Side DeveloperAuthor Commented:
Oh my Gosh!
Thank you so much.  I can't believe I overlooked #1.  That was the problem.
0
Brian TaoSenior Business Solutions ConsultantCommented:
You're welcome.  Glad that I am able to help.  Thanks for the points.
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.