Submit form parameters together

For general table data, and also with query conditions, we will use jquery easyui's datagrid to achieve.

 

Implementation generally needs to consider the two actions of initialization and re-querying. At this time, you need to do some operations for form parameters, such as submitting input parameters.

 

When there is a lot of input data, we can assemble and submit the data in the following ways:

 

$("#searchbtn").click(function(){ $("#preResultDetail").datagrid('reload',serializeForm($("#mysearch"))); });

 

function serializeForm(form){

var obj = {};

$.each(form.serializeArray(),function(index){

//The following this is an object of a form field

if(obj[this['name']]){

obj[this['name']] = obj[this['name']] + ','+this['value'];

} else {

obj[this['name']] =this['value'];

}

});

return obj;

}

 

mysearch is the id of the form. The background can be obtained by request getParameter

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326808566&siteId=291194637