Can't ajaxLink / Button send data from the ajax Options?

i’m trying to delete some table rows using ajaxLinks placed in a CActiveForm but its not sending the data specified in the ajax data options rathar something weird :


[ _ ] => 1297379479430

ajaxLink code:




<?php

$form = $this->beginWidget('CActiveForm', array(

		'id' => 'service-form',

		'enableAjaxValidation' => false,

	));

?>

......

......

<?php echo CHtml::ajaxLink('Delete', 'cas/index.php?r=service/deletetaskajax', array(

	'ajax'=>array(

		'type'=>'get',

		'success'=>'function(data){$(this).parent().parent().remove();}',

		'data'=>array('taskId'=>'5'),)),

array('id'=>'deleteRow'));	?>

......



when i use ajaxSubmitButton it Posts the whole CActiveForm Values.

Edit: just changed the original post to make it more precise.

As you are using the ajaxLink (check the documentation)… the 3rd parameter should be the ajax options… but you are here instantiating another ajax call… so its an ajax call on an ajax call… that leads to unpredictable results…

So your code should be like:




<?php echo CHtml::ajaxLink('Delete', '', array(

            	'type'=>'post',

            	'success'=>'function(data){alert("OK");}',

            	'data'=>array('taskId'=>'5')

		),

array('id'=>'deleteRow'));  	?>



where to specify the url then?

Yeah i followed as its in the documentation.


public static string ajaxLink(string $text, mixed $url, array $ajaxOptions=array ( ), array $htmlOptions=array ( ))

the second parameter is the URL and 3rd is the ajax options. so i given the action url in the 2nd.

Basically the problem is that the GET or POST data variables are somehow encoded to something else.


[taskId]=>'5' 

becomes


  [_]=>'1297415912485'

All other things are working fine, i get the proper response too from the action specified here in the url.

Used to work it this way now.

Row gets deleted, echo gets displayed but success, complete or error nothing runs.


echo CHtml::ajaxLink('Delete', bu().'/index.php?r=service/deletetaskajax&id='.$task->id,

			array('ajax'=>array(

				'success'=>'function(){alert(\'Task Deleted!\');}',

				'complete'=>'function(data){alert(data);}',

				'error'=>'function(){alert(\'error\');}',

				)),array(

				'id'=>'deleteRow'));




any clue…

Read again my comment #2… you again put an ajax call inside another ajax call…

Ohhhh… this is insanely bad of me <_<

i put the ‘ajax’ options array inside.

Thanks mdomba