[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1588
  • Last Modified:

Microsoft JScript runtime error: '$' is undefined - with jquery slider

hello,

i am getting the following error "Microsoft JScript runtime error: '$' is undefined" when i moved a website from one computer to another.  no code changed.  The initial computer was running visual studio web developer 2008, the new computer has vs web developer 2010.  I can not seem to figure out what is different, the project still references the same .net 3.5 framework.  The code works fine when put on the live web server, but I need to be able to run it locally.

the error is thrown on the following line of code in the aspx page head: $(function(){  (shown below)
 
<script type="text/javascript" src="../js/jquery-1.2.6.min.js"></script> 
	<script type="text/javascript" src="../js/jquery-easing-1.3.pack.js"></script> 
	<script type="text/javascript" src="../js/jquery-easing-compatibility.1.2.pack.js"></script> 
	<script type="text/javascript" src="../js/coda-slider.1.1.1.pack.js"></script> 	
	<script type="text/javascript"> 
	
		var theInt = null;
		var $crosslink, $navthumb;
		var curclicked = 0;
		
		theInterval = function(cur){
			clearInterval(theInt);
			
			if( typeof cur != 'undefined' )
				curclicked = cur;
			
			$crosslink.removeClass("active-thumb");
			$navthumb.eq(curclicked).parent().addClass("active-thumb");
				$(".stripNav ul li a").eq(curclicked).trigger('click');
			
			theInt = setInterval(function(){
				$crosslink.removeClass("active-thumb");
				$navthumb.eq(curclicked).parent().addClass("active-thumb");
				$(".stripNav ul li a").eq(curclicked).trigger('click');
				curclicked++;
				if( 6 == curclicked )
					curclicked = 0;
				
			}, 3000);
		};
		
		$(function(){
			
			$("#main-photo-slider").codaSlider();
			
			$navthumb = $(".nav-thumb");
			$crosslink = $(".cross-link");
			
			$navthumb
			.click(function() {
				var $this = $(this);
				theInterval($this.attr('href').slice(1) - 1);
				return false;
			});
			
			theInterval();
		});
	</script>

Open in new window

 

the error seems to indicate that the function cannot be found in the referenced java script files, but these exact libraries are working fine on other systems, so it has to be something in my environment that is killing it, but i don't know where to look

thanks in advance
0
jordanking
Asked:
jordanking
  • 3
2 Solutions
 
ZvonkoSystems architectCommented:
You go to browser address bar where this error occur and replace the page name with the first js file reference.
Like this:
When your page was:
http://your.server.com/your/folders/yourpage.htm

Then replace it:
http://your.server.com/your/folders/../js/jquery-1.2.6.min.js

If you get 404 then that was it!

0
 
Kusala WijayasenaSoftware EngineerCommented:
Most of the times, cause for " '$' is undefined" is missing reference to core jquery file (in your case jquery-1.2.6.min.js). So just check whether all the reference are OK in your project

-Kusala
0
 
jordankingAuthor Commented:
thanks zvonko and kusala,

I put the explicit path to all .js files in the browser url exactly as written in the html include, and they all work, the files are referenced fine and they all work perfectly when on the live remote server.

I thought it might be because .net 3.5 is the framework for the website and I am running windows 7, but i found out that windows 7 induces it in the turn on and off windows features through the control panel.  I made sure it was turned on, but it did no solve my problem.  

could there be another reason the .js files are not being accessed?
0
 
jordankingAuthor Commented:
thanks
0
 
jordankingAuthor Commented:
okay, thanks for sending me in the right direction.  The virtual path is the website settings within visual studio was set wrong, i changed it back to "/" like i had it on the previous computer and everything worked.  That explained why the files were not loading, i used firebug in firefox to get the actual path being requested which helped me find the virtual path setting.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now