Jquery dialog issue

Hello guys,

I have a problem with the use of dialog and various jquery ajax calls.

In one scenario at the touch of a button I do a ajax call.

This renders me a dialog.

The dialog works:

in turn makes an AJAX call

The close button closes the dialog window.

If the ajax call ,made ​​by the dialog, returns an error, pops up another dialog. If

I close this second dialog, I can not close over the first dialog.

I also noticed that the second dialog is not modal, despite having set the option to true

this is code of firs dialog




<?php

Yii::app()->clientScript->scriptMap=array(

         //scripts that you don't need inside this view

        'jquery.js'=>false,

	

        

		

);

$dlg = $this->beginWidget('zii.widgets.jui.CJuiDialog', array(

			'id' => "dialog_add_" . time(),

			'options' => array(

				'title' => Yii::t('app', 'title'),

				'autoOpen' => true,

				'width' => 'auto',

				'height' => 'auto',

				'modal' => true,

				'buttons' => array(

					Yii::t('app','Inserisci')=>'js:function(){ submitForm2( $(this).attr("id") )}',

					Yii::t('app', 'Chiudi') => 'js:function() {$(this).dialog("close");}',

			),

		)));


echo $msg;

echo $this->renderPartial('_form2', array(

	'model' => $model,

	'id_header' => $model->id_header,

	'id_category' => $model->id_category,

	'headerTxt' => $headerTxt[0],

	'categoryTxt' => $categoryTxt[0],

		), true, true);

$this->endWidget('zii.widgets.jui.CJuiDialog');




i solved

i add this




Yii::app()->clientScript->scriptMap=array(

         //scripts that you don't need inside this view

        'jquery.js'=>false,

	

        

		

);



jquery was called twice