Solved

jQuery / "'Sys' is undefined"

Posted on 2011-03-07
4
1,417 Views
Last Modified: 2012-05-11
Hi.  I am trying to use some way-cool jQuery alerts in my ASP.NET website.

One of the first alert() calls that I'm going to want to eliminate is actually called from my Page_Render() event on the server side.  It's a browser warning about IE.

After referencing this jQuery tool's js/css files and trying my app out in IE (so that it executes the RegisterClientScript() call that adds the new JS), I get this

'Sys' is undefined

error.  It happens in this part of the page's execution:

      $(document).ready(function() {
         Sys.Application.add_load(function() { Page_onLoad(); });
      });

Does not happen in Firefox...but then, remember, it's the server-side script registration that's bombing out with the new jQuery alert() tool.  

This same server-side code does not fail with the old conventional alert() call.

Now, here's the deal.  I can use Google, and there are tons and tons of "here's how to fix this problem" sites on the net that deal with this specific error.

I CAN comb through those, and I AM combing through those now.  But I'm posting this question in an attempt to find someone who has dealt with this particular error and has specific knowledge or experience with it to help me out.

I repeat:  I can use Google, and AM using Google, so please don't just send me links.  I've tried tons and tons of "fixes", and am STILL trying them.  None have worked.  Please--I need someone with knowledge/experience specific to this problem.

Thank you!  Happy to post web.config markup, or whatever, if that helps.
0
Comment
Question by:bamapie
[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
4 Comments
 

Accepted Solution

by:
bamapie earned 0 total points
ID: 35058975
I fixed this by adding the "$(document).ready(function() {" text around the server-side-added JS.  But I'll keep this question open in case someone has some insight more than just the workaround I'm posting.
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 35060785
I haven't done much reading on jQuery, but from what I understand your solution seems to be the "correct" way, not a workaround.  Otherwise, your JavaScript runs before the jQuery libraries have been loaded - hence the Sys is not defined error.

You can accept your own response as the correct answer to this question.
0
 

Assisted Solution

by:bamapie
bamapie earned 0 total points
ID: 35060815
OK, thanks.  It was just surprising that nothing in this equation gave me any trouble until I began using this "jquery.alerts" library.  Suddenly my registering of JS on the server was a problem...just didn't seem right.

Thanks again.
0
 

Author Closing Comment

by:bamapie
ID: 35115345
My workaround looks to be the conventional way of doing this.  Not clear on why this suddenly became a surprise on this jquery.alerts library.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…

695 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