Help with Yii AJAX

How can I use the CHtml::ajaxLink function to send data from a textBox in the ajax request?

What I mean is that in the $ajaxOptions array I can specify the data to pass in the ajax request, but the value of this data comes from the PHP. I cannot put a javascript function there to collect the data from textBox, because the JS is escaped.

So for example if I put as the value 'document.getElementById('textbox').value()', it will send that actual string, and not the value of textbox.

I hope this is clear and not too confusing.

Hi, i need your help

how to set selected option  from a dropdown list to a textfield

please source

i’m kind a stuck with it , too. If you get this done, please reply here. Thanks

hi, again!

i found solution. Look at this discussion:http://www.yiiframework.com/forum/index.php?showtopic=1256 lok at the last reply.


'data' => 'js:$("#someId").serialize()',

Or you can send multiple variables:


'data' => array('foo'=>'bar','dynamic'=>'js:$("#someId").serialize()'),

This wont work (i used this method before, without dynamic values):


'data' => 'name=John&age=17&js:$("#someId").serialize()',