[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2011-09-05
5
Medium Priority
?
1,584 Views
Last Modified: 2012-05-12
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
Comment
Question by:jordanking
[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
  • 3
5 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 750 total points
ID: 36484941
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
 
LVL 11

Assisted Solution

by:Kusala Wijayasena
Kusala Wijayasena earned 750 total points
ID: 36485772
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
 
LVL 1

Author Comment

by:jordanking
ID: 36486318
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
 
LVL 1

Author Closing Comment

by:jordanking
ID: 36486417
thanks
0
 
LVL 1

Author Comment

by:jordanking
ID: 36486421
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

649 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