-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.html
45 lines (39 loc) · 1.59 KB
/
compose.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<form id= "com-form" action="#">
<input type="text" name="recipient" id="recipient" placeholder="recipient"/>
<br />
<br />
<input type="text" name="subject" id="subject" placeholder="Subject"/>
<br />
<br />
<textarea name="msgBody" id="body" rows="10" cols="15" placeholder="Write your message here"></textarea>
<br />
<button class="btn btn-block btn-lg btn-primary" type="submit" id="submit-msg">Send Message</button>
</form>
<p id="status_upate"></p>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript">
/* global $ */
$(document).ready(function(){
//##########################Send Message########################################
$("#com-form").on('submit', function(e){
e.preventDefault();
console.log("text");
var recp = $("#recipient").val();
var subj = $("#subject").val();
var body = $("#body").val();
recp = recp.replace(" ",",");
var data = "recipients="+recp+"&subject="+subj+"&body="+body;
//########################send messages ajax request############################
$.ajax({
url: 'main.php',
type: 'POST',
data: data,
}).done(function (res){
console.log(res);
$("#status_upate").html(res);
$("#recipient").val('');$("#subject").val('');
$("#body").val('');
});
});
});
</script>