01.
<div
class
=
"wrapper"
>
02.
<form method=
"post"
id=
"comment-form-xs"
>
03.
04.
05.
<button
class
=
"center"
id=
'btnValidate'
type=
"submit"
style=
"color: #fff; background-color: #001654; border: 0px; border-radius: 20px; padding: 0px 30px; font-size: 100%;"
> เสร็จสิ้น </button>
06.
07.
</form>
08.
</div>
09.
10.
<script type=
"text/javascript"
>
11.
$(document).ready(
function
() {
12.
13.
14.
15.
$(
'#comment-form-xs'
).submit(
function
(e){
16.
17.
e.preventDefault();
18.
19.
$.ajax({
20.
url:
'submit_comment.php'
,
21.
type:
'POST'
,
22.
data: $(this).serialize()
23.
})
24.
.done(
function
(data){
25.
$(
'#form-content-xs'
).fadeOut(
'slow'
,
function
(){
26.
$(
'#form-content-xs'
).fadeIn(
'slow'
).html(data);
27.
});
28.
})
29.
.fail(
function
(){
30.
alert(
'Ajax Submit Failed ...'
);
31.
});
32.
});
33.
});
34.
</script>