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
Post a Comment