CGridView ajax delete does not work


I am new to Yii and I am struggeling with the following problem:

Delete button in CGridView does not make ajax call, so the delete does not work.

my admin.php view looks like this:

<?php $this->widget('zii.widgets.grid.CGridView', array(





















)); ?>

It generates following html for gridview delete:

jQuery('#event-grid a.delete').live('click',function() {

	if(!confirm('Are you sure you want to delete this item?')) return false;

	var th=this;

	var afterDelete=function(){};

	$.fn.yiiGridView.update('event-grid', {



		success:function(data) {




		error:function(XHR) {

			return afterDelete(th,false,XHR);



	return false;




After clicking on delete button, the code above executes, but it always get stuck on the following line in jquery.yiigridview.js:

options.url = $.param.querystring(options.url,;

and the only GET request processes and Error 400 rises.

actionDelete method in controller is default:

	public function actionDelete()





       // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser


        $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));


			//	$this->redirect(array('index'));



			throw new CHttpException(400,

					Yii::t('app', 'Invalid request. Please do not repeat this request again.'));


Could you please help me?

Thanks in advance.


Are you using RBAC or some role manager?

Hi Lukas,

Please, post the ajax result in Firebug after clicking the delete link, maybe there might be useful info.

Best regards,


Hi Ricardo, thanks for your reply. You pushed me to focus on how to catch an error, which was following:

$.param.querystring is not a function

Then I found, that I had included jquery.js twice (once default from yii engine and once mine) in my html head:

<script type="text/javascript" src="/game/assets/c7860054/jquery.js"></script>

<script type="text/javascript" src="/game/assets/c7860054/"></script>

<script type="text/javascript" src="/game/javascript/jquery-1.6.1.js"></script>

<script type="text/javascript" src="/game/javascript/jqueryslidemenu.js"></script>

So the problem is solved and all ajax request (delete, paging etc.) work now.

So thank you once again.


Hi Lukas,

I also had same issue, your post helps me to sort out. No need to include jquery.js in admin section. It works fine now.

Thank you for posting the answer !!