The js and HTML sections of the form action submission

  • 2020-03-30 01:15:20
  • OfStack

1. JS part of the code
 
 
function submitForm(action, actName, objName, formName,blogType){ 
$("#"+formName).attr("action",action); 
//var f = document.getElementsByTagName("form")[0]; 

//alert(f.action); 
$("#"+formName).form({ 
onSubmit:function(){ 
checkInput();//Check that the input item is empty
} , 
success:function(data){ 
if (data == "success"){ 
$.messager.alert(' prompt ','<br> Log published successfully !','info'); 
}else{ 

$.messager.alert(' prompt ','<br> Log publication failure !','warning'); 
} 
} 
}); 
} 
 
function publishBlog() { 
submitForm("http://localhost:8090/webplus3/_web/sns/createBlog.do?_p=YXM9Mw__"," published "," The log ","fm1","publish"); 
} 

2. HTML part
 
<form style="padding: 10px 8px;" method="post" action="" id="fm1" name="fm1"> 
<div style="margin-bottom: 10px;"> 
<span style="padding-right: 10px;"> The title :</span> 
<input type="text" id="title" name="blog.title" class="int_txt" maxlength="30"> 
</div> 
<div style="margin-bottom: 10px;"> 
<span style="padding-right: 10px;"> content :</span> 
<input type="text" id="content" name="blog.content" class="int_txt" maxlength="3000"> 
</div> 
<button class="btnstyle-strong btn-submit btn-submit-2" type="submit" title=" In the log (ctrl+enter)" id="saveBlogButton" onclick="publishBlog()"> 
<span> hair   table </span> 
</button> 
</form> 

Related articles: