Foam Gold-jquery serialized Form form "Support Ajax submit Form Object Form Entity.xxx"

Source: Internet
Author: User

need form form submission, large form to field background manual processing too cumbersome. Or is it convenient to choose Form Form Object (entity.xx), then how does Ajax submit such form object forms?


Name Jquery.commons.js content as follows

/** * form Object Form Ajax pre-submission data processing methods  *  @param  frm *  @returns  json object  */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;}

Examples are as follows

var myForm = Getformjson ($ ("#myform")); $.ajax ({url: ' saveappoint.action ', type: ' POST ', Data:myform, SUCC    Ess:function (data) {showmsg (data); }});

Form form Contents

<form id= "MyForm" ><input type= "hidden" id= "TimeType" name= "Appointment.timetype" readonly= "readonly" value= "<s:property value=" Appointment.timetype "/>"/><input type= "hidden" id= "Visitbegin" Name= " Appointment.visitbegin "readonly=" readonly "value=" <s:property value= "Appointment.visitbegin"/> "/>< Input type= "hidden" id= "Visitend" name= "Appointment.visitend" readonly= "readonly" value= "<s:property value=" Appointment.visitend "/>"/></form>

Action background

Private appointment appointment;public void Setappointment () {...} Public appointment getappointment () {...}


You can implement object form submission support.


Above, thank you!

Mo Mo Jin


This article from the "Mo Mo Gold It experience and skills" blog, reproduced please contact the author!

Foam Gold-jquery serialized Form form "Support Ajax submit Form Object Form Entity.xxx"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.