First look at the front desk Ajax section:
1$ (' #delMd '). Click (2 function(){3 if($ (' #reqState '). val () = = ' 2 '){4$. Dialog.show ("The application form has been submitted for approval and can no longer be changed");5 return false;6 }7 if($ ("#itemNo"). val () = = ' 0 '){8$. Dialog.show ("Please select master data to delete");9 return false;Ten } One Jquery.ajax ({ AURL: "Create/delmd.htm", -Data: {"Reqno": $ ("#reqNo"). Val (), "ItemNo": $ ("#itemNo"). Val ()}, -Type: "POST", theErrorfunction(data) { -$. Dialog.show ("form submission error, please try again later"); - }, -Successfunction(data) { + if(!data.success) { -$. Dialog.show (' Delete failed '); + return; A } at varReqname = $ (' #reqName '). Val (); - varReqno = $ (' #reqNo '). Val (); - varReqstate = $ (' #reqState '). Val (); - varPIID = $ (' #piid '). Val (); -$ (' #zcepcform ') [0].reset (); -$ (' #reqNo '). Val (reqno); in$ (' #reqState '). Val (reqstate); -$ (' #piid '). Val (piid); to$ (' #reqName '). Val (reqname); +$ ("#itemNo"). Val (0); - getmdlist (); the } * }); $ return false; Panax Notoginseng } -);
The data section can be used in this way, and you can also pass a form such as $ (' #testForm '). Serialize ()
The URL is the requested controller address
@RequestMapping ("zcepc/create/delmd.htm") @ResponseBody publicint ItemNo ) { = ZCEPCMANAGER.DELMD (reqno,itemno); return ri; }
Finally put the result in a result set. The foreground Ajax gets the background results, which are displayed in the page.
In this company to do projects are used in this structure, or very good understanding, is usually written code, pay more attention to some details, more thinking, write code before thinking is very important, which will let you less detours, avoid unnecessary time.