1. Bagian dari kode JS
Salin kode kode sebagai berikut:
/**
* Kirim formulir
*/
Function submitform (action, actName, objname, formname, blogType) {
$ ("#"+FormName) .attr ("Action", Action);
// var f = document.geteLementsByTagname ("form") [0];
// peringatan (f.action);
$ ("#"+formname) .Form ({
Onsubmit: function () {
checkInput (); // Periksa apakah item input kosong
},
Sukses: function (data) {
if (data == "sukses") {{
$ .Messager.alert ('prompt', '<br> Log berhasil!', 'Info');
} Kalau tidak {
$ .Messager.alert ('tips', '<br> log gagal!', 'Peringatan');
}
}
});
}
/**
* Menerbitkan log
*/
fublishblog () {
kirimForm ("http: // localhost: 8090/webplus3/_web/sns/createblog.do?
}
2. Bagian html
Salin kode kode sebagai berikut:
<Bentuk style = "padding: 10px 8px;"
<Div style = "margin-bottom: 10px;">
<span style = "Padding-Right: 10px;"> Judul: </span>
<input type = "text" id = "title" name = "blog.tital" maxlength = "30">
</div>
<Div style = "margin-bottom: 10px;">
<span style = "Padding-Right: 10px;"> Konten: </span>
<input type = "text" id = "content" name = "blog.content" maxlength = "3000">
</div>
<Type type = "kirim" id = "saveBlogButton" onclick = "publichblog ()">
<span> diposting </span>
</tombol>
</form>