Post Data Via Chtml::link To Action

I am trying to generate a PDF. I need the selected Row from my CGridView for data generation.

I created this link to open the PDF in a new tab:

echo CHtml::link('Generate PDF', array('generatePdf'),

		array('target'=>'_blank', 'class'=>'getParentId', 'onclick'=>'getData();'));


This function gets me the selected row:

function getData(){

	  var myPK = parseInt($.fn.yiiGridView.getSelection("masterbegehung-grid"));




            'url':'<?php echo Yii::app()->createAbsoluteUrl("Masterbegehung/generatePdf")?>',


            'data':{'parentID' : myPK,

            	YII_CSRF_TOKEN : $('input[name="YII_CSRF_TOKEN"]').val()},



The thing is, I cannot access the $_POST[‘parentID’] in my Controller action generatePdf().

It always says "undefined index".

What am I doing wrong there?

I think there is a problem with the url, cause I use the same action in my link and the post.

I tried the same with an ajaxlink, but I cant open a new tab, if this is possible with an ajaxlink?

You need to return false at the end of your getData() function or you’ll follow the link when you click it.

Still cannot access the $_POST[‘parentID’].