ajax - ajaxSubmitButton beforeSend add vars to request -


i have ajaxsubmitbutton beforesend option:

echo chtml::ajaxsubmitbutton('', chtml::normalizeurl(array('site/index')),      array(         'datatype'=>'json',         'data'=>'js:jquery(this).parents("form").serialize()',         'beforesend'=>'js:function(data){             // myarr "good" array param             mydata =$.param(myarr);             /** somethig **/         }',                   ) ); 

so how can add mydata request data , send post request?

it's easier expect, need create function returns params:

<script type="text/javascript"> function getmydata(){     return $.param(myarr); } </script> 

and concatenate data:

echo chtml::ajaxsubmitbutton('', chtml::normalizeurl(array('site/index')),      array(         'datatype'=>'json',         'data'=>'js:jquery(this).parents("form").serialize()+"&"+getmydata()',         'beforesend'=>'js:function(data){         }',                   ) ); 

Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -