I don't want to include jQuery to Page

As you know this code including :


<script type="text/javascript" src="/organizr/assets/b006594f/jquery.js"></script>

<script type="text/javascript" src="/organizr/assets/b006594f/jquery.yiiactiveform.js"></script>

But i don’t want to include jquery.js . Because i’m including it manually. How can i set it ?

As a second question, yiiactiveform.js is including to page after <head> . But i want to include it before </head> . How can i do it?

You are using a framework, you do not have to do something manually if the framework already do everything!!! If you do what are you trying to do, you’ll get off from the framework coding standard. My question is: why?

@sensorario, I don’t like Yii including jQuery on my behalf either, especially because I use CDN and want to include it at the bottom of the page, not in the head section.

I’ve extended CClientScript this way:




class ClientScript extends CClientScript {

    

    public function renderCoreScripts() {

        return;

    }

    

}



And in config:




'clientScript' => array(

    'class' => 'application.components.ClientScript',

),



Good luck :)

Thank you for your ideas. Now i found this code :

<?php Yii::app()->clientScript->registerCoreScript(‘jquery’); ?>

I’m using this on my all views which need jQuery ;)

Can i ask one more question. I’m sending my form via AJAX (using ajaxSubmitButton) . But when user click the submit button i want to show a message like “Record added to database” . Which way should i follow for this?

I’m not sure how to do that with “ajaxSubmitButton”. I would make my own javascript and register it with Yii::app()->clientScript->registerScript();

in your view file -


                    echo CHtml::ajaxSubmitButton('sumbit', $this->createUrl('record/create'), 

                                array('success'=>"function(html) {

                                       $('<div>'+html+'</div>').insertAfter($('#record-form');

                                   }, 'type'=>'POST'));

in your controller file -


public function actionCreate()

{

// code to save model attributes from POST var

if($model->save())

     echo "Record Added to database";

else

     echo new CHhtpException(500);

}

i have just given example code. Please adjust according to your requirements

To stop Yii from including a script/css file, you can also change it to some other file


Yii::app()->clientScript->scriptMap['jquery.min.js'] = false;