0

I have a "ReferenceError: $ is not defined" problem. People are recommending to call my JS code AFTER the page was fully loaded so I changed my page (header section) to this:

<script src="../PriceScript.js" type="text/javascript"></script>
<script>
$(document).ready(function () 
{
  PriceModBatchAsm('#IDModBatchAsm')   <-------- error here
});
</script>

However, again the same message: the $ is not defined.


Update:
I think I am not loading JQuery into my web page. The script worked in a different page because in that page the JQuery was already loaded like this:

  <script
    src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

Is this the proper way to load it?

Gabriel
  • 20,797
  • 27
  • 159
  • 293

2 Answers2

0

Depends on your usage. If you are going to use it everywhere, the proper way to load it would be some sort of master page that handled it across all your pages.

If you just need it on a few pages you could do it on just those pages.

You could also use some of the new(-ish) paradigms like bundling and minification.

TheNorthWes
  • 2,661
  • 19
  • 35
0

Solved.

I created 3 tiny images for each price that I wanted to show and put the images into my web pages. When price changes all I have to do is to update the images. This 'high tech' 100% reliable solution took me about 3 minutes.

Gabriel
  • 20,797
  • 27
  • 159
  • 293