Tag:eth for multipart list failed success ret -name value
<form class= "form-horizontal" action= "/biz/patent/edit" method= "post" enctype= " multipart/form-data " data-toggle="validator " role="form " novalidate="true " Id= "patenteditform" >
<Buttonclass= "Btn btn-primary"type= "button"ID= "But_sub">Save</Button> <Buttonclass= "Btn btn-primary"type= "button">Save Return list</Button> <Buttonclass= "Btn btn-warning"type= "button"onclick= "window.location= '/biz/project/list ';">Return</Button>
</form>
$ (document). Ready (function(){ varButtonID; $(' #patentEditForm '). Validator (). On (' Submit ',function(e) {if(e.isdefaultprevented ()) {//handle the invalid form ...}Else { //everything looks good! if(ButtonID = = "But_sub"){ varFormData =NewFormData ($ ("#patentEditForm") [0]); $.ajax ({type:"POST", URL:"/biz/", Data:formdata, DataType:"JSON", NSync:false, Cache:false, ContentType:false, ProcessData:false, Success:function(date) {Switch(date.status) { Case1: $success ("Saved successfully!" "); Break; Case1009: $error ("Save failed!" "); Break; default: $error ("No information submitted"); }}, Error:function() {$error ("No information submitted"); } }); return false; } } }); $(". Btn-primary"). Click (function() {ButtonID= $( This). attr ("id"); $(' #patentEditForm '). Trigger (' Submit '); });
$ (' #patentEditForm '). Validator (). On (' submit ') pass parameters (with global variables) between the processing methods of two events.
2. Use the. Trigger (' Submit ') method to trigger commits in JavaScript without the original form submission.
JavaScript solves a scenario with a validated form two submit event (a page remains "Ajax implementation", a page commits and jumps)