1. part of JS code
Copy code code as follows:
/**
* Submit the form
*/
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 whether the input item is empty
},
Success: Function (data) {
if (data == "Success") {{
$ .Messager.alert ('prompt', '<br> logs successfully!', 'info');
} Else {
$ .Messager.alert ('Tips', '<br> logs failed!', 'warning');
}
}
});
}
/**
* Published a log
*/
fublishblog () {
submitform ("http: // localhost: 8090/webplus3/_web/sns/createblog.do?
}
2. HTML part
Copy code code as follows:
<FORM style = "padding: 10px 8px;" Method = "Post" action = "ID =" fm1 "name =" fm1 ">
<div style = "margin-bottom: 10px;">
<span style = "padding-right: 10px;"> Title: </span>
<input type = "text" id = "title" name = "blog.tital" maxlength = "30">
</div>
<div style = "margin-bottom: 10px;">
<span style = "padding-right: 10px;"> Content: </span>
<input type = "text" id = "content" name = "blog.content" maxlength = "3000">
</div>
<Button type = "submit" id = "saveblogbutton" onClick = "Publicishblog ()">
<span> Posted </span>
</Button>
</form>