Examples are as follows:
Convert form to Ajax commit
function Ajaxsubmit (URL,FRM,FN) {
var datapara=getformjson (frm);
$.ajax ({
url:url,
type: "Post",
Data:datapara,
async:false,
dataType: ' txt ',
success: fn
});
Converts a value in a form to a key value pair
function Getformjson (frm) {
var o={};
var a=$ (frm). Serializearray ();
$.each (A,function () {
if (o[this.name]!==undefined) {
if (!o[this.name].push) {
o[this.name]=[o[ THIS.name]];
}
O[this.name].push (This.value | | '');
} else{
O[this.name]=this.value | | '';
}
});
return o;
}
//
/Foreground call mode
function Autosubmitfun () {
ajaxsubmit ("Autosumitscoreajax.action", $ (' #formId '), function () {});
*/
The above is a small set for everyone to bring the form form through Ajax to achieve no refreshing submission of a simple example of all the content, I hope that we support cloud Habitat Community ~