I having hard time fixing this error in my app.js. The error is in line 284 where app.js:262 Uncaught ReferenceError: $ is not defined
at HTMLDivElement. (app.js:262).
I just want to display (using alert) the information I collected from the getinfobyaccountno.php but my plan is to display them in html of course.
You can see that I have hardcoded the accountNumber variable. Actually it is one of my another concern because I have them as a global variable.
we recommend to assign it to some local variable with more handy name, like $$ , but not to “$” to prevent confilicts with other libraries like jQuery or Zepto
Thanks everyone. @kerrydp answer by adding jquery fix my concern.
Another of my concern is how to prepare, declare and access global variable, will prepare another question for that.
Basically $ is an alias of jQuery() so when you try to call/access it before declaring the function, it will endup throwing this $ is not defined error . This usually indicates that jQuery is not loaded and JavaScript does not recognize the $. Even with $(document).ready , $ is still going to be undefined because jquery hasn’t loaded yet.
To solve this error:
Load the jQuery library at the beginning of all your javascript files/scripts which uses $ or jQuery, so that $ can be identified in scripts .