jQuery error: jquery not being defined

Hello all,

I’ve started this topic in order to get some answers about jquery within Yii. the first question is going to be the most simple one and yet, it needs answering because I’m stuck:

I’m trying to display an alert using jquery just to see if it works, but i don’t get any alert message. The code is as follows:





Could anyone see an error in my code? Is there a flag or something that I need to set up before using this code?

Thanks a lot!


If I copy/paste the code into a yii default application it works for me.

Did you check the html output sourcecode …?

Did you check the console /javascript errors in your browser…?



	<script type="text/javascript" src="/yii/desticard/assets/4435e95e/jquery.js"></script>

<title>My Web Application</title>



</div><!-- page -->

<script type="text/javascript">


jQuery(function($) {







Thank you for the responses.

I was making a mistake by exitting the application in the view file after the jquery code definition. Removing the ‘exit;’ line from the view fixed the problem.

Thanks a lot!!


Thanks for the reply. The problem was in the view code and it’s fixed now!


Forgot to mention that @samdark got the solution to the issue.

I’d like to thank all of those who posted back in this topic or sent me private messages to help find the solution to my problem.

The topic could now be closed.