Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

jQuery / "'Sys' is undefined"

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
bamapie
Asked:
bamapie
  • 3
2 Solutions
 
bamapieAuthor Commented:
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
 
Todd GerbertIT ConsultantCommented:
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
 
bamapieAuthor Commented:
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
 
bamapieAuthor Commented:
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

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

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