EasyUI Forum

General Category => General Discussion => Topic started by: manojvijayan on December 27, 2012, 09:59:43 PM



Title: How can pass extra data when submit a form
Post by: manojvijayan on December 27, 2012, 09:59:43 PM
How can pass extra data which are not in the form when submit a form.Please see the example.

I want to pass extra data like  params:{product_id : '125','qnty':10,'price':500} instead of url:'page.php?product_id=125&qnty=10&price=500'' when submit a form


function submitForm(){          
                    
                        $('#ff').form('submit',{
             url:...,  
             params:{product_id : '125','qnty':10,'price':500}
            
         });  
}  


Title: Re: How can pass extra data when submit a form
Post by: stworthy on December 30, 2012, 08:29:50 PM
Please download the updated form plugin from http://www.jeasyui.com/easyui/plugins/jquery.form.js and try the following code:
Code:
$('#ff').form('submit',{
url:..., 
onSubmit:function(param){
param.product_id = '125';
param.qnty = 10;
param.price = 500
}
}); 


Title: Re: How can pass extra data when submit a form
Post by: andy on January 07, 2013, 10:12:37 PM
I using this code and it's work.  :)

$.post('127.0.0.1/data_save',
{
   Code : $('#position_text_code').val(),               
   Name : $('#position_combogrid_name').combogrid('getValue'),
   Address : $('#position_text_address').val()
}, function(result)
{
      $("#loading").html();
      fcn_datagrid_loadData();
});